Вопрос

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/]

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top