Home:ALL Converter>checkbox change using jquery/javascript not working inside bootstrap modal

checkbox change using jquery/javascript not working inside bootstrap modal

Ask Time:2015-12-21T19:36:59         Author:user-4653387

Json Formatter

i am trying to select/unselect all checkbox by checking one master checkbox inside my bootstrap modal, but javascript/jquery script not working with input type checkbox.

here is my html code-

<input type="checkbox" id="checkAll"/>

here is jquery-

$(document).ready(function() {
    $("#checkAll").change(function () { alert('here');
        $("input:checkbox").prop('checked', $(this).prop("checked"));
    });
});

when i check on checkbox it doesn't show alert.

why this not working in bootstrap modal?

I've tried to show alert inside input tag like this-

<input type="checkbox" id="checkAll" onclick="alert('hello');"/>

which also not works!

Author:user-4653387,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/34394774/checkbox-change-using-jquery-javascript-not-working-inside-bootstrap-modal
Rohit Azad Malik :

Try to this way used to .on\n\n\r\n\r\n$(document).ready(function() {\r\n $(\"#checkAll\").on('change', function () { alert('here');\r\n var inputCheck =$(this);\r\n console.log(\"Checked -\"+inputCheck .is(\":checked\"));\r\n \r\n });\r\n});\r\n<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js\"></script>\r\n<input type=\"checkbox\" id=\"checkAll\"/>",
2015-12-21T11:40:31
Clemens Himmer :

This might be cause by not using .on.\n\nSee my JSFiddle that will explain your situation.",
2015-12-21T11:50:02
yy