[jQuery] Re: Set event handler attributes does not work on IE7
Sorry I don't have a copy of IE7 to test with right now, but what happens if you change 'change' to 'focus' or 'click' or some other event? Does it fire the onInputChange function as expected? On Apr 20, 6:07 pm, Joshua Partogi joshua.j...@gmail.com wrote: Thanks James! I still wonder why it doesn't work on IE7 though. Cheers, On Apr 21, 11:55 am, James james.gp@gmail.com wrote: You should do: $(.input).change(onInputChange); or: $(.input).bind(change, onInputChange); On Apr 20, 3:49 pm, Joshua Partogi joshua.j...@gmail.com wrote: Dear all, I'm trying to set event handler attributes when the DOM is ready, but it doesn't work on IE7. The snippets are as such: script type=text/javascript var onInputChange = function (){ alert(Hey I'm changed); } $(function() { $(.input).attr(onchange, onInputChange();); }); /script input type=text class=input / Now I tried this on FF3 and I can see in Firebug that jQuery successfully adds the onchange attributes to the input text. But this does not work on IE7. Though it is interesting that if I add other attributes like value to the textinput it works. Is this the problem with IE7? Has anyone experienced this before?
[jQuery] Re: Set event handler attributes does not work on IE7
You should do: $(.input).change(onInputChange); or: $(.input).bind(change, onInputChange); On Apr 20, 3:49 pm, Joshua Partogi joshua.j...@gmail.com wrote: Dear all, I'm trying to set event handler attributes when the DOM is ready, but it doesn't work on IE7. The snippets are as such: script type=text/javascript var onInputChange = function (){ alert(Hey I'm changed); } $(function() { $(.input).attr(onchange, onInputChange();); }); /script input type=text class=input / Now I tried this on FF3 and I can see in Firebug that jQuery successfully adds the onchange attributes to the input text. But this does not work on IE7. Though it is interesting that if I add other attributes like value to the textinput it works. Is this the problem with IE7? Has anyone experienced this before? Thank you very much in advance. -- If you can't believe in God the chances are your God is too small. Read my blog:http://joshuajava.wordpress.com/ Follow us on twitter:http://twitter.com/scrum8
[jQuery] Re: Set event handler attributes does not work on IE7
Thanks James! I still wonder why it doesn't work on IE7 though. Cheers, On Apr 21, 11:55 am, James james.gp@gmail.com wrote: You should do: $(.input).change(onInputChange); or: $(.input).bind(change, onInputChange); On Apr 20, 3:49 pm, Joshua Partogi joshua.j...@gmail.com wrote: Dear all, I'm trying to set event handler attributes when the DOM is ready, but it doesn't work on IE7. The snippets are as such: script type=text/javascript var onInputChange = function (){ alert(Hey I'm changed); } $(function() { $(.input).attr(onchange, onInputChange();); }); /script input type=text class=input / Now I tried this on FF3 and I can see in Firebug that jQuery successfully adds the onchange attributes to the input text. But this does not work on IE7. Though it is interesting that if I add other attributes like value to the textinput it works. Is this the problem with IE7? Has anyone experienced this before?