<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>jQuery Get Selected Radio Button Value</title> <script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("input[type='button']").click(function(){ var radioValue = $("input[name='gender']:checked").val(); if(radioValue){ alert("Your are a - " + radioValue); } }); }); </script> </head> <body> <h4>Please select your gender.</h4> <p> <label><input type="radio" name="gender" value="male">Male</label> <label><input type="radio" name="gender" value="female">Female</label> </p> <p><input type="button" value="Get Value"></p> </body> </html>
article
Thursday, November 5, 2015
jQuery Get Selected Radio Button Value
jQuery Get Selected Radio Button Value