- js获取select选中项的值
var LFQY = $("#id").find("option:selected").text();
2.js获取 单选项的值
<asp:RadioButtonList runat="server" ID="rblOption" RepeatDirection="Horizontal">
<asp:ListItem Text="选项1" Value="1" Selected="True"></asp:ListItem>
<asp:ListItem Text="选项2" Value="0"></asp:ListItem>
</asp:RadioButtonList>
var vl=$("input[name='rblOption']:checked").val()
本文介绍如何使用JavaScript获取HTML页面中select选择框的选中值及单选按钮组(radioButtonList)的选中值。对于select元素,通过jQuery选择器结合:selected属性可以轻松实现;对于单选按钮,则可以通过查找已选中的input元素并调用.val()方法来读取其值。
1268

被折叠的 条评论
为什么被折叠?



