Question

I would like to add "check all" and "uncheck all" button to this script. My js coding skills isnt too good and any help would be highly appricated.

See working example jsfiddle here: [http://jsfiddle.net/Efz72/38/]

Was it helpful?

Solution

Sounds like you want to add a button that calls the following jQuery function:

function checkAllCheckboxes(){
   $('input:checkbox').attr('checked', true) 
}

The HTML code for the button should look something like:

 <input type="button" value="Check All" onclick="checkAllCheckboxes();" />

Two notes: 1. The <input> tags in your code does not have a closing bracket ( /> ) 2. You want the checkAllCheckboxes function above to be defined as 'No wrap - in <head>' in JSFiddle for this to work properly there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top