Foffaf Foffaf
asked on
How to make other radio button checked?
Hi, I have this script below. I need to change the checked inline radio button to Option 3.
How to do that when I click "Clear All"?
Thanks in advance.
How to do that when I click "Clear All"?
Thanks in advance.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<form>
<label class="radio-inline">
<input type="radio" name="optradio" checked>Option 1
</label>
<label class="radio-inline">
<input type="radio" name="optradio">Option 2
</label>
<label class="radio-inline">
<input type="radio" name="optradio">Option 3
</label>
</form>
</div>
<script language="javascript" type="text/javascript">
function clearallapplyto()
{
//need to set checked at Option 3
}
</script>
<div id="mydiv" style="min-height:35px;">
<big>Apply To <span style="color: red">*</span></big> 
<a href="#" onclick="clearallapplyto();return false;"><label style="cursor:pointer" class="c">Clear All</label></a>
</div>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.