function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nidhi Sharma 13Nidhi Sharma 13 

Input field visible if radio button option is yes


I want that output label - "How many sub-projects" and input field be visible only when radio button "yes" is checked, otherwise invisible. How can I do it in VF


Please refer to code

<apex:pageBlockSection title="Project Details">
       <apex:panelGrid columns="2">
        <apex:outputLabel value="Project Name" for="gprojectName"/>
        <apex:inputField id="gprojectName" value="{!}"/>
      <apex:pageBlockSection title="Decision">
       <apex:panelGrid columns="2">
          <apex:outputLabel value="Does it have sub-project(s)?" 
          <apex:selectRadio id="radiobtn">
          <apex:selectOption id="radiobtn1" itemLabel="No" itemValue="1"></apex:selectOption>
          <apex:selectOption id="radiobtn2" itemLabel="Yes" itemValue="2"></apex:selectOption>
              <apex:outputLabel id="labid" value="How many sub-projects" for="gsubproject"/>
              <apex:inputField id="gsubproject" value="{!gproject.sub}"/>