469,621 Members | 1,733 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,621 developers. It's quick & easy.

onChange Event is not working

In JavaScripts checks for an onChange event against the value of the
textbox at the time of the last onChange event. Since an onChange
Event never fired after you changed the text first time , suppose we
put the same value in the text box then no event is fired.

If we put some other value then it became fired...
It wouldn't fire if we put the same value...

I don't want to use onBlur etc... Isthere any solution with onChange
Event...?

Asit
Jul 23 '05 #1
2 11693
Asit wrote:
In JavaScripts checks for an onChange event against the value of the
textbox at the time of the last onChange event. Since an onChange
Event never fired after you changed the text first time , suppose we
put the same value in the text box then no event is fired.
If we put some other value then it became fired...
It wouldn't fire if we put the same value...
I don't want to use onBlur etc... Isthere any solution with onChange
Event...?
Asit


Asit,

Can I ask why you don't want to use onblur? It sound right for what
you're describing.

http://tech.irt.org/articles/js058/

# onChange - select, text, or textarea field loses focus and its value
has been modified.

# onBlur - form element loses focus or when a window or frame loses focus.

--------

For IE ONLY (NOT Netscape/Firefox...) you might try 'onpropertychange',
it will catch text entry identical to the original text value, or
pasting the original text value.

If you use it - you probably should include 'onchnage' for non-IE
browsers, but I think 'onblur' would be more appropriate. So unless you
are using 100% IE, I would recommend onblur.
<script type="text/javascript">
function doit() { alert('onchange fired'); }
function doit2() { alert('onpropertychange fired'); }
function doit3() { alert('onblur fired'); }
</script>

<table>
<tr>
<td>onchange</td>
<td><input type="text" value="onchange" onchange="doit()" size="28"></td>
</tr>
<tr>

<td>onpropertychange</td>
<td><input type="text" value="onchange, onpropertychange"
onpropertychange="doit2()" onchange="doit()" size="28"></td>
</tr>
<tr>
<td>onchange</td>
<td><input type="text" value="onblur" onblur="doit3()" size="28"></td>
</tr>
</table>

Good Luck,
Mike

Jul 23 '05 #2
This onChange bug was recently discussed in this newsgroup.
See http://groups.google.com/groups?thre...eda.datanet.hu
for a DOM oriented approach.

"Asit" <hi*****@rediffmail.com> wrote in message
news:ed**************************@posting.google.c om...
In JavaScripts checks for an onChange event against the value of the
textbox at the time of the last onChange event. Since an onChange
Event never fired after you changed the text first time , suppose we
put the same value in the text box then no event is fired.

If we put some other value then it became fired...
It wouldn't fire if we put the same value...

I don't want to use onBlur etc... Isthere any solution with onChange
Event...?

Asit

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by b_naick | last post: by
7 posts views Thread by Peter | last post: by
3 posts views Thread by Mister Joe | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.