Friday, July 6, 2012

jquery check only one checkbox


 

how to check only one checkbox in gridview
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>


<script language="javascript">
function checkOnly(x)
  {
  $('.checkbox').attr("checked", false);
    $(x).attr("checked", true);
  }      
</script>
</head>

<body>
<form >
<input type="checkbox" name="cb1" value="1" class="checkbox" onclick="checkOnly(this)">
<input type="checkbox" name="cb2" value="1" class="checkbox"  onclick="checkOnly(this)">
<input type="checkbox" name="cb3" value="1" class="checkbox"  onclick="checkOnly(this)">
</form>





1 comment:

If you Satisfied , Please Leave a comment