Here is jquery script used to select radio button.
function radio(){
var presetValue = "scholar";
$("[name=identity]").filter("[value="+presetValue+"]").attr("checked","checked");
}
The scrip is invoked on page load.
This is XHTML peace of code:
<label for="scholar"> Scholar </label>
<input type="radio" name="identity" id="scholar" value="scholar" />
</td>
<td>
<label for="oracle"> Oracle </label>
<input type="radio" name="identity" id="oracle" value="oracle"/>
</td>
<td>
<label for="both"> Both </label>
<input type="radio" name="identity" id="both" value="both"/>
When the program runs that ‘scholar’ radio button is not selected.
What might be the problem?
Best regards
If you’re using jQuery >= 1.6, you should use
prop().Also, you’re using a complicated selector for nothing. Since your inputs have id’s, this will do it:
If
presetValuechanges (i.e: you simplified the code), do this: