advanced jquery concepts code example
Example: jquery advace
$(document).ready(function(){
selectable = $(":checked.selectable");
$("#selectall").click(selectAll);
selectable.click(changeNumFilters);
changeNumFilters();
});
var selectable;
function changeNumFilters()
{
var size = $(":checked.selectable").length;
if (size > 0)
$("#selectedCount").html(size);
else
$("#selectedCount").html("0");
}
function selectAll()
{
var checked = $("#selectall").attr("checked");
selectable.each(function(){
var subChecked = $(this).attr("checked");
if (subChecked != checked)
{
$(this).click();
}
});
changeNumFilters();
}