html coding for textbox

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I want to create a <br> textbox coding that is when I type in textbox
and I click enter for the next line, it will automaticly change to
<br> as i view the source or post it. How will the coding look like?

html coding for textbox

Veer wrote:
Quoted text here. Click to load it

   You really should do this on the server. And this is not an html
question but a javascript question.

   Now that I've mostly satisfied the disclaimers:

<textarea onchange="this.value=this.value.replace(/\n/g,'<br>')">
<input type="button" value="change">

   The onchange will trigger when you move to a different form element.
You could use onkeydown for instant confusion in place of delayed
confusion when your users find the textarea is changing what they typed.
Hence why you should do this server side. If you have to do this client
side, consider triggering it from an onsubmit in the form tag.


Site Timeline