I have a reset function function with this line:
- $('input[type="checkbox"]').prop("checked", true);
It checks all the checkboxes automatically. This works fine. However, I also have a click event on the checkbox. How can I activate this event when I use the line above?
I tried this with a listener, see example code:
- $('input[type=checkbox]').change(
- function(){
- if (this.checked) {
- alert('checked');
- }
- });
But the .prop event does not trigger this listener change event.
How can I loop through each checkbox inside a form, check the box if unchecked, and trigger a click-event connected to the checkbox. To make it more complex... the current onclick event uses a parameter, onClick="toggle('bunnies');"
Any ideas or suggestions?
Thank you!