I have this multiple checkboxes with same name attribute : myTask
<input type="checkbox" class="sol-checkbox" name="myTask" value="1B">
<input type="checkbox" class="sol-checkbox" name="myTask" value="2B">
<input type="checkbox" class="sol-checkbox" name="myTask" value="3B">
and
I have this jQuery code to perform every time the user clicks on the checkboxes
$("input[name='myTask'").change(function(){
alert(1);
});
is there anything wrong with my script?
$("input[name=myTask]").change(function(){I tried this but still not working..$("input[name=myTask]")you may need to wrap your code in$(document).ready(function(){ // your code here }).. ِAlso keep eyes on console for errors$(document).ready(function(){ $("input[name=myTask]").change(function(){ alert(1); }); });Tried this one still not working and I also checked the console log no error found$(document).on('change' , "input[name=myTask]" , function(){alert(1)})f12and note any console errors. If you wrap it in adocument.loadyou shouldn't get any issues (unless it wants you to put your script below your body - which happens. Please check the console.