Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1805 How can I take "wrapped" text from a form's input field, and at some event of my chosing, double-space it?

You are here: irt.org | FAQ | JavaScript | form | 3.5 | Q1805 [ previous next ]

Try this:

<script>
var cr = '\n';
function doublespace(formField) {
  return formField.value.replace(cr,cr+cr);
</script>

Or to use an event handler directly:

<textarea rows=10 onChange="cr='\n';this.value=this.value.replace(cr,cr+cr)" wrap="hard"<>/textarea>

©2018 Martin Webb