I'm trying to check the second radio button in a pair of 2 that are dynamically created in the front-end .cshtml page. The code is as follows:
<div class="g6">
<form>
@foreach (var method in myProxy.GetCategorys())
{
<input type="radio" name="myCat" data-bind="@MVVM.CheckedBindingFor(a => a.Category)" value="@method.Code"/>
<label class="radio-inline">@method.Name</label>
}
</form>
</div>
It produces 2 radio button like this in the rendered source code:
<input type="radio" name="myCat" value="ABC" data-blur-setup="true">
<input type="radio" name="myCat" value="DEF" data-blur-setup="true">
I am trying to have the second one ie "DEF" enabled.
This works from the Chrome console:
$(':radio[value="DEF"]').prop('checked', true);
But does not work from the corresponding ViewModel.
Its firing before the page has fully loaded. Anyone with any ideas?
I tried adding some Javascript to the chstml page but it wont accept it.
Any nice quick ideas?