This is a simple code to make your checkbox act like a radio button. Try this simple code and find out.
jQuery('.chck').click(function(){
jQuery('.chck:checked').not(this).removeAttr('checked');
});
How to Use:
html
<input type='checkbox' name='mygroup1' value='1' class='unique'>
<input type='checkbox' name='mygroup2' value='2' class='unique'>
<input type='checkbox' name='mygroup3' value='3' class='unique'>
jQuery
$('input.unique').click(function() {
$('input.unique:checked').not(this).removeAttr('checked');
});
No comments:
Post a Comment