HighDots Forums  

onChange Event is not working

Javascript JavaScript language (comp.lang.javascript)


Discuss onChange Event is not working in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Asit
 
Posts: n/a

Default onChange Event is not working - 04-21-2004 , 12:34 AM






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

Reply With Quote
  #2  
Old   
mscir
 
Posts: n/a

Default Re: onChange Event is not working - 04-21-2004 , 02:42 AM






Asit wrote:
Quote:
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



Reply With Quote
  #3  
Old   
Csaba Gabor
 
Posts: n/a

Default Re: onChange Event is not working - 04-21-2004 , 05:38 AM



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_asit (AT) rediffmail (DOT) com> wrote

Quote:
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



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.