Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the Document</title> <script src="https://code.jquery.com/jquery-3.5.0.min.js"> </script> </head> <body> <div> <label> <input type="radio" name="check button" id="radiobtn1"> Radio Button 1</label> <label> <input type="radio" name="check button" id="radiobtn2"> Radio Button 2</label> </div> <div> <button type="button" class="checkRadioBtn1">Checked Radio Button 1</button> <button type="button" class="checkRadioBtn2">Checked Radio Button 2</button> </div> <script> $(document).ready(function() { $(".checkRadioBtn1").click(function() { $("#radiobtn1").prop("checked", true); }); $(".checkRadioBtn2").click(function() { $("#radiobtn2").prop("checked", true); }); }); </script> </body> </html>