我有两组按钮,我喜欢按钮的作用像单选按钮,所以只能选择一个按钮。如何使按钮充当与jQuery的单选按钮?
例如:
<div id="top">
<div class="span2">
<input type=button value="10" id="top_A" name="top_A" onclick="yourPick(this)"/>
</div>
<div class="span2">
<input type=button value="20" id="top_B" name="top_B" onclick="yourPick(this)"/>
</div>
</div>
<div id="bottom">
<div class="span2">
<input type=button value="30" id="top_C" name="top_C" onclick="yourPick(this)"/>
</div>
<div class="span2">
<input type=button value="40" id="top_D" name="top_D" onclick="yourPick(this)"/>
</div>
</div>
所以,你可以在DIV底部选择在顶部只是按钮10或20比30或40。
有什么建议吗?
PS:
function yourpick(pick){
var pValue= pick.value;
alert(pValue);
$('#topPick').val(pValue);
$('#bottomPick').val(pValue);
}
如何http://jqueryui.com/demos/button/#radio从jQuery UI的 – Matt
哪些错误?有单选按钮? – simonlchilds
@csharpsi,界面是基于按钮,所以对于用户我喜欢使用按钮。马特看起来很有前途我要检查它 – alex