我有兩組按鈕,我喜歡按鈕的作用像單選按鈕,所以只能選擇一個按鈕。如何使按鈕充當與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