返回列表 發帖

JQuery UI Radio問題

本身Default是選擇了A
當有一個button, 按下便會變更, 自動選擇B
請問應該怎樣實現?

小弟試了這個, 便不行...
$("input:[name='order']").attr("checked",'1');
如果是普通的input radio是可以的, 但使用了JQueryUI後便不行了
謝謝
<div id="radio">                                                        
<input type="radio" id="radio1" name="order" value="0"  Checked/><label for="radio1">A</label>
<input type="radio" id="radio2" name="order" value="1"  /><label for="radio2">B</label>                                        
<input type="radio" id="radio3" name="order" value="2"  /><label for="radio3">C</label>
</div>        

本帖最後由 Mesak 於 2011-3-15 19:08 編輯
$("input[name='order'][value='1']").attr("checked",true);
checked 可用 TRUE 與 FALSE 做 核選動作

TOP

本帖最後由 rayin 於 2011-3-17 11:19 編輯
checked 可用 TRUE 與 FALSE 做 核選動作
Mesak 發表於 2011-3-15 19:07


謝謝你的回覆, 改了但一樣是沒有反應
我check過, button的value是改變了, 但外觀上沒有被click
為何value改變了但外觀上沒有變?要自行修改css嗎?
我查看css, 當button被click的改變如下
<input type="radio" value="1" name="order" id="radio1" class="ui-helper-hidden-accessible" type="radio" value="1" name="order">
<label for="radio1" aria-pressed="false" class="ui-button ui-widget ui-state-default ui-button-text-only" role="button" aria-disabled="false" style="width: 170px;"><span class="ui-button-text">ALL</span></label>
<input type="radio" value="1" name="order" id="radio1" class="ui-helper-hidden-accessible" type="radio" value="1" name="order">
<label for="radio1" aria-pressed="true" class="ui-button ui-widget ui-state-default ui-button-text-only ui-state-active" role="button" aria-disabled="false" style="width: 170px;"><span class="ui-button-text">ALL</span></label>
<label>中的aria-pressed由fales->true和class中多了 ui-state-active

TOP

抱歉沒仔細看你的需求 JQUERY UI 是把 原物件隱藏

要重新顯示狀態要重新 RELOAD JQUERY UI
$("input[name='order'][value='1']").attr("checked",true).button("refresh"); 
試試

TOP

回復 4# Mesak

原來可以這麼簡單!!
謝謝你唷!

TOP

返回列表 回復 發帖