Last Updated: February 25, 2016
·
761
· coreygrunewald

Fire a Checkbox Change in IE 7/8

$('input[type=checkbox]').click().change();

While writing some unit tests, I came across the issue of programmatically clicking a checkbox in IE was not actually updating the associated property in the Backbone model. Calling the .change() method forces the change event to occur, properly updating the model.

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