スタイルのある UI ボタンを使用しています - Like | ビ | 私 | 私 | う | この例のページでは、生成された html 構造は次のようになります。
<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>
「aria-pressed」プロパティを「true」に変更すると、ボタンはまったく変更されません...この方法を試しましたが、機能しませんでした:
var myhappyidtest = 2;
$('.radiocheck input').each(function(i){
if(myhappyidtest == $(this).val()){
$(this).next('label').attr('aria-pressed', 'true');
}
});
ボタンの場合、リフレッシュできることがわかりました。しかし、この場合、ラベルを使用してこれを行う方法についてはわかりません。
誰かがアイデアを持っていますか?