I need to seperate the checked and unchecked checkbox. Please any one help me...

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

I need to seperate the checked and unchecked checkbox. Please any one help me...

Thilakar
I need to seperate the checked and uncheckde checkbox from set of checkbox.  Please below and get me right solution for that


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CheckboxJquery</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript"> $('document').ready( function() { var b = $('#hid').val(); for (var i=0; i<b; i++) { var data ="<li><input type='checkbox' id='"+i+"'>Example"+i+"</li>"; $('#aa').append(data); //$('td').css({'border-right':'1px solid red', ''}); $('.checklist').append(data); } //var a = $('input[type="checkbox"]').length; //$('input[type="checkbox"]').attr("checked"); //if ($(this).is(':checked')) { //} /* for (j=0; j<a; j++) { var che = $("input[type=checkbox]:checked").length; alert (che); if(che > 3)) { alert ('this is 2'); } else { alert('you clicked more than four'); } }*/ $('#mer').click( function() { var che = $('input[type="checkbox"]:checked').filter(":checked").length; //alert($('input[type="checkbox"]:checked').filter(":not(:checked)").length); $('input[type="checkbox"]:checked').attr('disabled', true); }); /* for (var j=0; j<=b; j++) { function isEven(j) { if (j%2 == 0) alert(j); return true; else return false; } } */ /* $(function() { $('input[type="checkbox"]').bind('click',function() { if($('input[type="checkbox"]:checked').length == 2) { $(':checked').attr('disabled', true); } }); }); */ }); </script>  <style type="text/css"> .wrapper { width:900px; height:auto; margin:0 auto; } .checklist { margin:0px; padding:0px; } ul.checklist { margin:0px; padding:0px; } ul.checklist li { list-style-type:none; } .dull { color:#ccc; } </style></head>
<body>
<div class="wrapper">
<input type="hidden" name="no. of checkbox" value="15" id="hid"/>
<ul class="checklist">
</ul>
<input type="button" value="merge" id="mer" />
</div>
</body>
</html>