I have 2 buttons yes
and no
, and simply I am toggling them.
<!DOCTYPE html>
<html>
<head>
<title>Demo Project</title>
</head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src=""></script>
<script>
function enableCheckBoxAndDisableNoRadioButton() {
$(".checkbox").attr("checked",true);
$("#no").attr("checked", false);
}
function disableCheckBoxAnddisableYesRadioButton() {
$("#yes").attr("checked", false);
$(".checkbox").attr("checked",false);
}
</script>
<body>
<input class="checkbox" type="checkbox" >
<p>yes <input id="yes" type="radio" onchange="enableCheckBoxAndDisableNoRadioButton()"></p>
<p> no<input id="no" type="radio" checked=true onchange="disableCheckBoxAnddisableYesRadioButton()"></p>
</body>
</html>
When I click at yes
, that time no button getting deselected and checkbox getting selected.
But when I click at the no
button, that time checkbox getting deselected but yes
button is selected too. I want to make it deselect.
Let me know what is the problem.
I am running this code on chrome: 53.0.