Saturday, March 23, 2013

Checkbox act as radio button in html

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<script src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3.2/jquery.min.js"></script>
<title>Sandbox</title>


</head>
<body>
<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'>
<script>
$('input.unique').click(function() {
    $('input.unique:checked').not(this).removeAttr('checked');
});
</script>


</body>
</html>

No comments:

Post a Comment

Thank you for your Comment....

Popular Posts