gpt4 book ai didi

jquery - 获取 jQuery mobile 中选项按钮的值

转载 作者:行者123 更新时间:2023-12-03 22:29:19 25 4
gpt4 key购买 nike

如果我有以下 jQuery 移动 html;

<fieldset data-role="controlgroup" data-type="horizontal" name="Smoker" id="Smoker">
<input name="radio3" id="radio3" value="Yes" type="radio" />
<label for="radio3">Yes</label>
<input name="radiobuttons1" id="radio4" value="No" type="radio" />
<label for="radio4">No</label>
</fieldset>

我想我可以在 jQuery 中做到这一点;

$("#Smoker").val()

但是这不会产生任何结果。我实际上是否需要查询两个输入以查看哪一个已被检查,或者是否有一种很好的 jQuery Mobile 方法来执行此操作?

最佳答案

尝试

$("#Smoker :radio:checked").val();

关于jquery - 获取 jQuery mobile 中选项按钮的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10612047/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com