+ Start a Discussion
ReplyReply 

Reg: How can i hide and unhide the components using check box

hi,

 

i have a check box on my VF page.

I don't have controller to my page.

When i click on that check box i need to display <input type="text"> in my VF page.

 

 

ANKITAANKITA

<apex:page >
 <script>
    function js()
    {
        var c = document.getElementById('j_id0:j_id2:chk').checked;
        if(c){
            document.getElementById('j_id0:j_id2:out').style.display="block";
        }else{
            document.getElementById('j_id0:j_id2:out').style.display="none";
        }
    }
  </script>

  <apex:form >
        <apex:inputCheckbox onclick="return js();" id="chk"/>
        <br/>
        <apex:outputpanel id="out" style="display:none" >
       
            <apex:inputtext />
            <apex:inputtextarea />
        </apex:outputpanel>
  </apex:form>
</apex:page>

 

 

Try this. It may be helpful