2016-12-02 3 views

答えて

1

場合、個々のIDをターゲットにすることなく、これらを対象DRY jqueryの呼び出しでこれを行うことを好むだろう、私はタブインデックス機能を

<div class="col-sm-12 app-label-text"> 
       @if (Model.Member == null) 
       { 
        @Html.RadioButtonFor(m => m.foo, "true", Yes)<text> Yes &nbsp; &nbsp;</text> 
        @Html.RadioButtonFor(m => m.foo, "false", No)<text> No</text> 
       } 
       else 
       { 
        if ((bool)Model.foo.Value) 
        { 
         @Html.RadioButtonFor(m => m.foo, "true", YesChecked)<text> Yes &nbsp; &nbsp;</text> 
         @Html.RadioButtonFor(m => m.foo, "false", No)<text> No</text> 
        } 
        else 
        { 
         @Html.RadioButtonFor(m => m.foo, "true", Yes)<text> Yes &nbsp; &nbsp;</text> 
         @Html.RadioButtonFor(m => m.foo, "false", NoChecked)<text> No</text> 
        } 
       } 
      </div> 

をRadioButtonForヘルパーをターゲットにすることができないということです"Yes"、 "No"などの変数があると仮定すると、Dictionary という属性を追加できます。それは私のために働きます。

Yes.Add("tabindex", 0); 

DEMO

+0

どうもありがとうございました、これは完璧に動作しますが、私はこの問題は、私は有効にすることができますが、その時点で無効になっていた要素をターゲットにしようとしていたということだったと後で気づきました。 – Joshua

関連する問題