Friday, June 26, 2009

[jQuery] Set radio buttons in jQuery Dialog

I have a 2 radio buttons in a jQuery Dialog :

<table>
<tr>
<td><input id="ArriveTriggerIgnition" name="ArriveTrigger"
type="radio" value="ignition"/></td><td>Ignition off at Location</td>
</tr>
<tr>
<td><input id="ArriveTriggerIdle" name="ArriveTrigger"
type="radio" value="idle" /></td><td>Arrive when Idle for</td>
<tr>
</table>

I am setting the radio button based on another value before opening
the dialog:

if (triggerIgnition == "True") {
$("#ArriveTriggerIgnition")[0].checked = true;
}
else {
$("#ArriveTriggerIdle")[0].checked = true;
}

I have also tried:

$("#ArriveTriggerIgnition").attr("checked", true); & $
("#ArriveTriggerIgnition").attr("checked", "checked");

Is there something in the jQuery Dialog that is blocking this or is my
syntax simply wrong? Thanks!

No comments: