2025年3月22日 星期六 甲辰(龙)年 月廿一 设为首页 加入收藏
rss
您当前的位置:首页 > 计算机 > 编程开发 > JavaScript

拿到 选中的单选按钮(name为‘activeRedio’)的值

时间:12-09来源:作者:点击数:24

拿到 选中的单选按钮(name为‘activeRedio’)的值

  • <!DOCTYPE html>
  • <html>
  • <head>
  • <meta charset="UTF-8">
  • <title></title>
  • </head>
  • <script type="text/javascript" src="js/jquery-1.4.js"></script>
  • <body>
  • <input type="radio" id="queryType_jh" value="1" name="activeRedio" checked="checked" /> 批号:
  • <input type="text" id="jh" name="jh" value="" style="ime-mode: disabled; width: 80px" />
  • <input type="radio" id="queryType_nd" value="2" name="activeRedio" /> 年度:
  • <select name="nd" id="nd" style="width:70px;height:18px;" autoWidth="true" value="2">
  • <option value="1"></option>
  • <option value="2"></option>
  • <option value="3"></option>
  • </select>
  • <td><input type="button" value="增加记录" id="add" onclick="xinzeng();" /></td>
  • </body>
  • <script type="text/javascript">
  • function xinzeng() {
  • $('input[name=activeRedio]:checked').val(); //拿到 选中的单选按钮(name为‘activeRedio’)的值
  • console.log($('input[name=activeRedio]:checked').val())
  • }
  • </script>
  • </html>
在这里插入图片描述
在这里插入图片描述
方便获取更多学习、工作、生活信息请关注本站微信公众号城东书院 微信服务号城东书院 微信订阅号
推荐内容
相关内容
栏目更新
栏目热门