You can use the 'checked' property of the checkbox object (how intuitive).if (checkbox.checked) {
// handle
}
Also see http://www.w3schools.com/htmldom/dom_obj_checkbox.asp
This has actually nothing to do with JSF. It's just basic JS+DOM knowledge.
Thanx for the reply Balu. I tried the way which u asked me but here I have some problem. Since I have a list of check box in a data table and the check box is created dynamically.
i tried with
function enableField(thisObj, thisEvent)
{
isNode1Selected = false;
var str;
//if (form1:tableEx1:0:checkbox2.checked) {
alert(document.getElementById('form1:tableEx1:0:checkbox2').checked);
//}
<h:selectBooleanCheckbox id="checkbox2"
styleClass="selectBooleanCheckbox"
valueChangeListener="#{pc_ProjectAdministration.handleCheckbox2ValueChange}"
value="#{varprojectData.projectName}"
title="click it to select or deselect"
onclick="enableField();"></h:selectBooleanCheckbox>
and it returns true only when I check the first one. Since it has 0. Can please suggest me the way where i can get true value if i select any of the check box.
Regards
Rishab