jquery - Select all checkboxes with a text link -


I have created a form with a "Select All" checkbox that selects all other checkboxes in that form is.

I want to modify it, so all the functions will be selected below with a text link, such as:

link

  & lt; A href = "# 'id =" check ALL "& gt; Select all checkboxes & lt; / a & gt;   

Currently, to select all other checkboxes,

Form

  form action = "#" method = "post" id = "Myform" & gt; Fields & gt; & lt; div class = "radio" & gt; & lt; input type = "checkbox" name = "check ALL" id = "check ALL" & gt; = "Check ALL" & gt; Check all & lt; / label & gt; & lt; / div & gt; & lt; div label = "checkbox 1" & gt; checkbox & lt; / label & gt; & lt ; / Div & Gt; Check & lt; div class = "radio"> input type = "checkbox" name = "checkbox2" id = "checkbox2" & gt; & lt; label = "checkbox2" & gt; Box & lt; / labels & gt; & lt; / div & gt; & lt; div class = "radio" & gt; & lt; input type = "checkbox" name = "checkbox 3" id = "checkbox 3" & Gt; & lt; label = "checkbox 3" & gt; checkbox & lt; / label & gt; & lt; / div & gt; & lt; div class = "radio" & gt; & Lt; Input type = "checkbox" name = "checkbox 4" id = "checkbox 4" & gt; & Lt; Label = "checkbox 4" & gt; Checkbox & lt; / Label & gt; & Lt; / Div & gt; & Lt; Div class = "radio" & gt; & Lt; Input type = "checkbox" name = "checkbox 5" id = "checkbox 5" & gt; & Lt; Label = "checkbox 5" & gt; Checkbox & lt; / Labels & gt; & Lt; / Div & gt; & Lt; Div class = "radio" & gt; & Lt; Input type = "checkbox" name = "checkbox 6" id = "checkbox6" & gt; & Lt; Label = "checkbox6" & gt; Checkbox & lt; / Label & gt; & Lt; / Div & gt; & Lt; Div class = "radio" & gt; & Lt; Input type = "checkbox" name = "checkbox 7" id = "checkbox 7" & gt; & Lt; Label = "checkbox 7" & gt; Checkbox & lt; / Label & gt; & Lt; / Div & gt; & Lt; Div class = "radio" & gt; & Lt; Input type = "checkbox" name = "checkbox 8" id = "checkbox8" & gt; & Lt; Label = "checkbox 8" & gt; Checkbox & lt; / Labels & gt; & Lt; / Div & gt; & Lt; Div class = "radio" & gt; & Lt; Input type = "checkbox" name = "checkbox 9" id = "checkbox 9" & gt; & Lt; Label = "checkbox 9" & gt; Checkbox & lt; / Labels & gt; & Lt; / Div & gt; & Lt; Div class = "radio" & gt; & Lt; Input type = "checkbox" name = "checkbox 10" id = "checkbox 10" & gt; & Lt; Label = "checkbox 10" & gt; Checkbox & lt; / Label & gt; & Lt; / Div & gt; & Lt; / Fieldset & gt; & Lt; / Form & gt;   

Script

  & lt; Script type = "text / javascript" & gt; Click the $ (function () {$ ('# check') (function () {$ ('field'). (': Checkbox') .tir ('checked', this check);}) ;}); & Lt; / Script & gt;   

I have seen online and can not find the solution for this, any help would be greatly appreciated, thanks

checkbox to a link and replace it with this.checked , with true if you want Always select all the checkboxes for the link. Try adding data-check = "incorrect" as a feature of the link in

Update HTML then the following should do the trick: / P>

  $ ('#cancel'). Click (function () {var check = $ (this) .data ('check'); $ ('(': checkbox ') address (' check ', checked); $ (this). 'Checked', checked);});    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -