Results 1 to 2 of 2

Thread: textarea to innerHTML

  1. #1
    Join Date
    Jan 2011

    textarea to innerHTML

    Hello everyone!
    I have a small "problem". I'm new in Javascript. I want whatever I write in a textarea field being typed automatically in a <p> I have the script needed but
    it gets delayed -1 character. Here's the script. Paste it and tell me what's wrong

    <script type="text/javascript">
    function writeText(txt)

    <form name="form1">
    <textarea cols="45" rows="5" name="comment" onkeyPress="writeText(document.form1.comment.value)"></textarea>

    <p id="desc"></p>

    Thanks in advance

    PS: By the way... How can I make it appear some HTML code when there characters start to be typing?

  2. #2
    Join Date
    Dec 2002
    St. Louis, MO, USA
    Instead of using onKeyPress, use onKeyUp or onChange.


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center