<div class="form-group field-userform-custtype required">
<label class="control-label" for="custtype1">Custtype</label>
<input type="hidden" name="UserForm[custtype]" value="">
<div id="custtype1" class="flip">
<label class="radio-inline"><input type="radio" name="UserForm[custtype]" value="1"> B2C</label>
<label class="radio-inline"><input type="radio" name="UserForm[custtype]" value="2"> B2B</label>
<label class="radio-inline"><input type="radio" name="UserForm[custtype]" value="3"> Both</label></div>
<div class="help-block"></div>
</div>
在这里,我想提取所选无线电的值。我试着通过以下方式获得价值:
$('input:radio[name=UserForm[custtype]]:checked').val()
但没有运气。
所需的输出:1或2或3基于选择.
请帮我一下,谢谢。
发布于 2014-12-13 23:10:22
你的代码看起来很好。你刚刚忘记了名字的引号。应该是这样的:
$('input:radio[name="UserForm[custtype]"]:checked').val()
希望它有用!
https://stackoverflow.com/questions/27464488
复制相似问题