From Internet, I saw code below for handling multi-select check boxes on a list table view:
$(document).ready(function(){
// Activate tooltip
$(‘[data-toggle=“tooltip”]’).tooltip();
// Select/Deselect checkboxes
var checkbox = $('table tbody input[type="checkbox"]');
$("#selectAll").click(function(){
if(this.checked){
checkbox.each(function(){
this.checked = true;
});
} else{
checkbox.each(function(){
this.checked = false;
});
}
});
checkbox.click(function(){
if(!this.checked){
$("#selectAll").prop("checked", false);
}
});
});
I’d like to know how the line
var checkbox = $(‘table tbody input[type=“checkbox”]’);
can pick up rows from a specific user’s table? I can only imaging such javascript execution is bundled with request session somehow, and knows all the contexts? If so, does that mean multiple table templates can also use the same ID like #selectAll here without conflict?