<br> html coding for textbox

Discussion in 'HTML' started by Veer, Feb 4, 2008.

  1. Veer

    Veer Guest

    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?
    Veer, Feb 4, 2008
    #1
    1. Advertising

  2. Veer

    Jeff Guest

    Veer wrote:
    > 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
    Jeff, Feb 4, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hazzard
    Replies:
    2
    Views:
    534
    Yan-Hong Huang[MSFT]
    Jul 23, 2003
  2. Natty Gur
    Replies:
    0
    Views:
    449
    Natty Gur
    Jul 22, 2003
  3. =?Utf-8?B?Q2hyaXM=?=
    Replies:
    3
    Views:
    13,740
    Peter Blum
    Mar 30, 2005
  4. James O'Riley
    Replies:
    4
    Views:
    1,105
    James O'Riley
    May 5, 2006
  5. calmar
    Replies:
    11
    Views:
    756
    calmar
    Feb 21, 2006
Loading...

Share This Page