Archive for the 'Jquery' Category

Simple check all with Jquery:

function checkAll(el, fieldName){
var checkBoxes = $(‘input[name=' + fieldName + ']‘);
var curValue = el.value;
if(curValue == ‘Check All’){
$.each(checkBoxes, function() {this.checked = true});
el.value = ‘Uncheck All’;
} else {
$.each(checkBoxes, function() {this.checked = false});
el.value = ‘Check All’;
}
}

How to use?
Pass in the “this” keyword as the first parameter. Second, pass in the name of the fields that [...]