How To Know That Primefaces Selectbooleancheckbox Is Selected Or Not Using Javascript?
I want to get p:selectBooleanCheckbox component and check if it is selected or not using javascript
Solution 1:
You can define the widgetVar of your selectBooleanCheckbox
<p:selectBooleanCheckbox id="check" widgetVar="myCheckbox" value="#{myBacking.value}"/>
You can access in js the Primefaces object in these ways
directly with myCheckbox
PF("myCheckbox")
window["myCheckbox"]
PrimeFaces.widgets["myCheckbox"]
So, to get the checkbox state you can use
myCheckbox.input.is(':checked')
PF("myCheckbox").input.is(':checked')
window["myCheckbox"].input.is(':checked')
PrimeFaces.widgets["myCheckbox"].input.is(':checked')
Post a Comment for "How To Know That Primefaces Selectbooleancheckbox Is Selected Or Not Using Javascript?"