문제

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