[英]jquery mobile: get selected radiobutton
I'm not sure how can I get the selected radio button in jQuery mobile (I'm using version 1.4.3). 我不确定如何在jQuery mobile中获得选定的单选按钮(我使用的是1.4.3版)。 The checked attribute doesn't change whenever I click one of the radio buttons.
每当我单击单选按钮之一时,选中的属性都不会更改。 Actually, when I inspect the elements I see that only attribute data-cacheval is changing.
实际上,当我检查元素时,我看到只有属性data-cacheval在改变。 Is it safe to use this attribute to get the selected radio button?
使用此属性来获取所选单选按钮是否安全? This is the code I'm using for the radio buttons:
这是我用于单选按钮的代码:
<input type="radio" name="chkViewType" id="chkViewType2" data-mini="true">
<label for="chkViewType2" data-mini="true">List</label>
<input type="radio" name="chkViewType" id="chkViewType1" data-mini="true">
<label for="chkViewType1" data-mini="true">Map</label>
You can use the :checked
selector : 您可以使用
:checked
选择器 :
eg 例如
$("[name='chkViewType']:checked")
Also, you should probably read the Attributes vs. Properties paragraph in the documentation . 另外,您可能应该阅读文档中的“ 属性与属性”段落。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.