Last Updated: February 25, 2016
·
2.311K
· iondrimba

Using INPUT CHANGE event on IE

On IE the change event behaves in a diferent way. The event only gets fired when the input loses the focus.

So if you need to get a realtime change event that works fine in all major browsers + IE, I suggest to use a very similiar event, KEYUP event.

//FAILS in IE

        var txt = $(selector);
        txt.change(function (evt) {
            console.log("change");
        });

//OK in IE
        var txt = $(selector);
        txt.keyup(function (evt) {
            console.log("keyup");
        });

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside