Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery .on('input') doesn't get fired in ie8 alone

I'm having this issue specific to IE8. This event doesn't fire in IE8 alone, but is working fine in IE9 and other browsers like Firefox and Chrome.

$('#myId').on('input', function () {
   //do something.
}

Please let me know if there is any work around for the same in IE8.

Thanks!

like image 734
user2721870 Avatar asked Oct 03 '13 13:10

user2721870


3 Answers

Older versions of IE have an event called propertychange that you can use. You can check for the propertychange event and the input event at the same time:

$('#myId').on("propertychange input",function(ev){
    doAwesomeThing();
});
like image 119
AaronBaker Avatar answered Sep 23 '22 13:09

AaronBaker


oninput is IE9+, that is why it does not work in IE8

MDN oninput

Feature         Chrome    Firefox    Internet Explorer    Opera    Safari
Basic support   (Yes)     2          9                    10       (Yes)
like image 26
epascarello Avatar answered Sep 20 '22 13:09

epascarello


AaronBaker's answer: Works for both IE8 and IE10(html5) as well as modern browsers... without double post of event

I would have used comment or upvote but rep too low.

$('#myId').on("propertychange input",function(ev){
    doAwesomeThing();
});
like image 21
Richard Dufour Avatar answered Sep 21 '22 13:09

Richard Dufour