【发布时间】:2019-04-23 01:34:39
【问题描述】:
我有下面的html代码
<fieldset id="a">
<input type="radio" name="choice1" value="1" radioatrr="0" class="myvalue1" /><label for="choice1">text 1</label>
<input type="radio" name="choice2" value="2" radioatrr="0" class="myvalue2" /><label for="choice2">text 2</label>
<input type="radio" name="choice3" value="3" radioatrr="0" class="myvalue3" /><label for="choice3">text 3</label>
</fieldset>
<fieldset id="b">
<input type="radio" name="cb-choice1" value="4" radioatrr="1" class="myvalue4" /><label for="cb-choice1">text 4</label>
<input type="radio" name="cb-choice2" value="5" radioatrr="1" class="myvalue5" /><label for="cb-choice2">text 5</label>
</fieldset>
如果选择了choice2 并且cb-choice1 或cb-choice2 之一被选中,那么如果选中了choice2 并且没有cb-...检查然后收到的值为2。
我该怎么做?
我试试这个
$("input:checked").each(function(i) {
if (($(this).attr("radioatrr") == 0)) {
alert(($(this).attr("value"));
}
})
但不能按我的意愿工作
【问题讨论】:
-
你用js尝试过什么吗?有的话可以分享一下吗?
-
你的问题也不清楚。包括预期结果
标签: javascript jquery jquery-mobile radio-button