I've been looking over and over this one for a while and just can't see where the issue is. This should be a simple thing. What I'm doing is putting a link in a table header column to "Select All" and that would check all of the checkboxes. I've found code to do that but for some reason I can't get the click to even show a simple alert. When I click on the link nothing happens and there are no errors in the DevTools console either.
This is the basic code. I've copied and pasted the ID to make sure there wasn't an misspell but I'm thinking I'm overlooking something simple. I even wrote out the $(document).ready instead of using the $ short cut...grasping for anything.
$(document).ready(function () {
//$("#checkAll").change(function () {
// $("input:checkbox").prop('checked', $(this).prop("checked"));
//});
$("#checkAll").click(function () {
alert("clicked");
});
});
<th class="col-md-1">
<a href="#" id="checkAll">Select All</a>
</th>
Not sure if this has something to do with it but the table is in a MVC partial view that get's loaded by Ajax. Also, the JS code is in a separate file and not in the page. I know that the reference to that JS file is good because it also contains the Ajax code and that piece is working.
Any ideas on what I can try?