Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-29-2009, 02:27 PM   PM User | #1
nikko50
Regular Coder

 
Join Date: May 2004
Posts: 375
Thanks: 62
Thanked 0 Times in 0 Posts
nikko50 is an unknown quantity at this point
disable onchange event

How all.
I have a field that has an onkeypress event that populates fields through an ajax script. The other fields that get populated have an onchange event so when they are populated with the ajax script the onchange event gets triggered which is not what I want. Is there anyway I can disable the onchange event while the onkeypress field is receiving input from the user?
nikko50 is offline   Reply With Quote
Old 01-29-2009, 03:46 PM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,033
Thanks: 197
Thanked 2,410 Times in 2,388 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Looking at the below, it would appear that (in IE at least) onchange only fires when the data in the field is altered by the user, that is after the field receives focus.

Code:
<input type = "text" id = "txt1" size = "20" onchange = "a1()">
<input type = "text" id = "txt2" size = "20" value = "Tracy" onchange = "alert ('Value of txt2 has changed')">

<script type = "text/javascript">
function a1() {
document.getElementById("txt2").value = "Philip";
}
See also:-
http://forums.devshed.com/javascript...ts-581334.html


Edit: Tested in Firefox, same result.



James (007) Bond: (to Bibi) You get your clothes back on, and I'll buy you an ice cream.

Last edited by Philip M; 01-29-2009 at 05:06 PM..
Philip M is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

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

Forum Jump


All times are GMT +1. The time now is 06:12 AM.


Advertisement
Log in to turn off these ads.