views:

23

answers:

1

It seems propertychange events are ignored when a field is disabled. Is there a way to run code when the value changes?

<input id="country" onpropertychange="alert(country.value)" disabled="disabled"/>
<input type="button" onclick="country.value='USA'" value="Go" />
A: 

Could you not just add in your event inside the button's onclick attribute after country.value='USA'? For example:

<input id="country" disabled="disabled" />
<input type="button" onclick="country.value='USA'; alert(country.value)" value="Go" />
chigley
Normally yes, but in my case no. The click handler is third-party code that I can't touch. I can add a second click hander but there's no guarantee which one will be called first. Is there an event which fires after click? 'Clicked' perhaps?
Anthony Faull