Welcome Guest, Not a member yet? Register   Sign In
jQuery: check/uncheck all checkboxes with specific value
#2

[eluser]bitist[/eluser]
Code:
<script language="JavaScript" type="text/javascript" src="jquery.js"></script>
<script language="Javascript" type="text/javascript">
$(document).ready(function() {
   $("#toggle5").click(function(event){
      $('input[@type=checkbox]').each( function() {
        if($(this).val()==5)
          this.checked = !this.checked;
      });
   });
});
</script>

<a href="#" id="toggle5">Toggle 5ve</a>

&lt;form method="post" action="" style="margin:0px"&gt;
&lt;input type="checkbox" name="a" value="1" id="" /&gt;
&lt;input type="checkbox" name="b" value="2" id="" /&gt;
&lt;input type="checkbox" name="c" value="3" id="" /&gt;
&lt;input type="checkbox" name="d" value="4" id="" /&gt;
&lt;input type="checkbox" name="e" value="5" id="" /&gt;
&lt;input type="checkbox" name="f" value="5" id="" /&gt;
&lt;/form&gt;

This will toggle checkboxes which have value=5.


Messages In This Thread
jQuery: check/uncheck all checkboxes with specific value - by El Forum - 02-11-2009, 12:08 PM



Theme © iAndrew 2016 - Forum software by © MyBB