我使用的UI buttons with style - Like | B | I | U | in this example page,和HTML結構生成這個樣子:刷新「詠歎調壓」與標記UI按鍵/類型
<div class="radiocheck ui-buttonset">
<input type="radio" name="radio1" value="1" id="radio0" class="ui-helper-hidden-accessible">
<label for="radio0" aria-pressed="false" class="ui-button ui-widget ui-state-default ui-button-text-only ui-corner-left" role="button" aria-disabled="false">
<span class="ui-button-text">Sobre</span>
</label>
<input type="radio" name="radio1" value="2" id="radio1" class="ui-helper-hidden-accessible">
<label for="radio1" aria-pressed="false" class="ui-button ui-widget ui-state-default ui-button-text-only" role="button" aria-disabled="false">
<span class="ui-button-text">Politica</span>
</label>
<input type="radio" name="radio1" value="3" id="radio2" class="ui-helper-hidden-accessible">
<label for="radio2" aria-pressed="true" class="ui-button ui-widget ui-state-default ui-button-text-only" role="button" aria-disabled="false">
<span class="ui-button-text">Outros</span>
</label>
<input type="radio" name="radio1" value="4" id="radio3" class="ui-helper-hidden-accessible">
<label for="radio3" aria-pressed="false" class="ui-button ui-widget ui-state-default ui-button-text-only ui-corner-right" role="button" aria-disabled="false">
<span class="ui-button-text">Promocoes</span>
</label>
當我改變「詠歎調-pressed」 propertie到‘真’,按鈕不會改變在所有...我tryed這種方式,但它沒有工作:
var myhappyidtest = 2;
$('.radiocheck input').each(function(i){ if(myhappyidtest == $(this).val()){ $(this).next('label').attr('aria-pressed', 'true'); } });
我看到ŧ帽子在按鈕的情況下,有可能刷新。 但我不知道如何在這種情況下使用標籤來做到這一點。
有人有想法嗎?
我認爲詠歎調屬性是專門爲輔助技術來幫助傳達信息,以禁用的用戶。我不相信它對按鈕的外觀有任何影響。 – clamchoda 2011-04-12 20:58:05
謝謝克里斯!我找到了解決方案......非常簡單! =)我只是將** ui-state-active **類添加到元素,然後將** aria-pressed **設置爲** true **並且它可以工作! – 2011-04-13 11:23:25
不是問題,快樂編碼;) – clamchoda 2011-04-13 14:40:03