首页 > Web开发 > 详细

jquery获取radio和select选中值

时间:2015-11-10 19:03:15      阅读:244      评论:0      收藏:0      [点我收藏+]
//jquery 获取radio选中值

<input type="radio" name="c_type" value="a" >aaaa
<input type="radio" name="c_type" value="b" >bbbb
<input type="radio" name="c_type" value="c" >cccc 

<script src="jquery-2.1.4.min.js"></script>
<script>
  $(‘input[name="c_type"]‘).click( function () {
    var item = $("input[name=‘c_type‘]:checked").val(); 
    alert(item);
  });
</script>


//jquery 获取select选中值

<select name="c_type" id="select">
  <option value="a">aaaa</option>
  <option value="b">bbbb</option>
  <option value="c">cccc</option>
</select>

<script src="jquery-2.1.4.min.js"></script>
<script>
  $("#select").change(function(){
    var item = $("#select option:selected").val(); 
    alert(item);
  });
</script>

  

 技术分享

 

jquery获取radio和select选中值

原文:http://www.cnblogs.com/qhorse/p/4953832.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!