Is there a way to access to an id of selectItem
JSF from JavaScript or jQuery?
<a:commandButton id="ajaxButton" value="change" onclick="selectCheck()">
</a:commandButton>
<h:selectManyCheckbox id="check" >
<f:selectItem id="myCheckbox" itemLabel="India" itemValue="India" />
<f:selectItem itemLabel="China" itemValue="China" />
<f:selectItem itemLabel="Germany" itemValue="Germany" />
<f:selectItem itemLabel="USA" itemValue="USA" />
</h:selectManyCheckbox>
I try to access the id of the component but it returns null:
function selectCheck() {
var obj = document.getElementById("myCheckbox");
alert(obj);
obj.checked=true;
}
I want to check any of theses checkboxes dynamically by JavaScript or jQuery.