By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,813 Members | 1,257 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,813 IT Pros & Developers. It's quick & easy.

onChange Event is not working

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.