I have a problem triggering a click event.
This is the code which should be called by the "click":
$('#enable_autosave').click(function () {
alert("HI");
});
The HTML code:
<input type="checkbox" id="enable_autosave">Test</input>
And this is the code which should trigger the checkbox' click-event after loading the page:
$('#enable_autosave').trigger('click');
The checkbox gets checked but the click-event isn't fired. I also tried .click() or .onclick() or $('#enable_autosave').attr('checked', true)[0].onclick();
But they all show the same result, the checkbox gets checked but not click-event.
Aucun commentaire:
Enregistrer un commentaire