<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css" rel="stylesheet">
<div class="container mt-5">
<h3>Bootstrap Radio Button Validation</h3>
<label class="control-label">Select a USA college:</label>
<label><input type="radio" name="college" value="harvard">Harvard University</label>
<label><input type="radio" name="college" value="stanford">Stanford University</label>
<label><input type="radio" name="college" value="mit">Massachusetts Institute of Technology</label>
<button type="submit" class="btn btn-primary">Submit</button>
<p id="selectedCollege"></p>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.bundle.min.js"></script>
$(document).ready(function () {
$('#myForm').submit(function (event) {
event.preventDefault(); // Prevent the form from submitting
// Check if any radio button is checked
var selectedCollege = $('input[name="college"]:checked').val();
alert('Please select a college!');
// Display the selected college on the web page
$('#selectedCollege').text('Selected College: ' + selectedCollege);