Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    OnChangeEvent of Textbox is not firing in IE but fires in Opera

    Onchange event of textbox is not firing in IE under this condition but fires in Opera.

    Condition:
    After changing the value, in the tab key press again i'm changing the value dynamically at this time the onchange event is not firing. But it works fine in Opera. Have a look at the code.
    --------------------------------------------------------------------------
    <html>
    <head>
    </head>
    <body>
    <form>
    <input type="text" name="1" id="1" onkeydown="one_onkd();" onchange="txt_onchange();"><input type="text" name="2" id="2" onchange="txt_onchange();">
    </form>
    </body>
    <script>
    function one_onkd()
    {
    if (event.keyCode==9)
    {
    document.getElementById("1").value="newvalue";
    }
    }
    function txt_onchange()
    {
    alert("On Change event of " + event.srcElement.id);
    }
    </script>
    </html>
    --------------------------------------------------------------------------

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    onchange will not fire the function until the field loses it's focus (onblur), this is the reson for usually it is better to use unkeyup instead of onchange in case of text fields or textareas.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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