how to get radio button value in jquery

how to get selected radio button value in jquery

index.html

<!DOCTYPE html>
<html>
<head>
    <title>How to get selected radio button value in Jquery? - pakainfo.com</title>
    <script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script>
</head>
<body>
   
<input type="radio" name="sex" class="sex" value="male"> Male
<input type="radio" name="sex" class="sex" value="female"> Female
<button>Click to redirect</button>
   
<script type="text/javascript">
   
    $(".sex").change(function(){
        var selValue = $("input[type='radio']:checked").val();
        console.log(selValue);
    });
   
</script>
  
</body>
</html>

Also Read This ๐Ÿ‘‰   HTML input time with 24 hours format