<br> html coding for textbox

V

Veer

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?
 
J

Jeff

Veer said:
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?

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:

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

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.

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top