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>





Comments

Post a Comment

If you Satisfied , Please Leave a comment

Popular posts from this blog

Call PHP Function In JavaScript Using Ajax

List of Post Category Wise in wordpress