i have requirement where i need to check if apex:inputCheckbox is checked, and if it isn’t then raise an alert saying that its not checked.
<apex:inputCheckbox value="{!check}"/>
I am raising the alert from a java script. i am using actionfunction to call a apex method after the alert is raised.
What i need is a way to check if the checkbox is checked or not in javascript
Thanks
Prady
You can just give it an id, then use
document.getElementById()to grab it:Note that if it’s inside other elements with you may need to drill down to it, so if it was inside an
<apex:pageBlockSection>withid="theSection"then you’d need:Whether you need to do this or not depends on where your javascript is in the page with relation to the checkbox. Good luck!