<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>jQuery</title> <script src="jquery-3.3.1.min.js"></script> </head> <body> <script type="text/javascript"> $(function(){ // 按钮单击时执行 $("#btnInfo").click(function() { //$(".divInfo").hide(); alert($('input[name="sex"]:checked').val()); }); }) </script> <div class="divInfo"> <input type="radio" name="sex" value="1" />男 <input type="radio" name="sex" value="2" />女 </div> <button id="btnInfo" type="button">jQuery</button> </body> </html>