jQuery radio 选中提示

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>radio  选中提示</title>
    <script src="scripts/jquery-1.7.1.min.js"></script>

</head>
<body>
  <script type="text/javascript"> 
    $(document).ready(function(){ 
     $("input[name=payType]").click(function () {
      if ($(this).attr("checked")) {
        alert("选中了");
      }
    });
   }); 
  </script> 
  <div>
    <label>
      <input name="payType" type="radio" value="paypal" />
      <span></span> 男</label>
      <p></p>
      <label>
        <input name="payType" type="radio" value="wiretransfer"/>
        女</label>
        <p></p>

      </div>
    </body>
    </html>

 

posted @ 2017-10-26 15:49  拈花醉  阅读(255)  评论(0编辑  收藏  举报