+ Start a Discussion
prasanth sfdcprasanth sfdc 

how to find parent siblings using jquery in vf page

Hi,   If i click on "edit" text in the below image, then i need to hide all the <apexoutputext> tag in that row and display all <apex:inputtext> tags in that same row where i click the "edit" text. So I need to get the siblings ids <apexoutputext> tag.  Please help to solve this. 

User-added image

<apex:pageBlockTable value="{!categories}" var="c">
          <apex:column width="25px">
            <apex:inputCheckbox value="{!c.checked}"/>
        <apex:column headerValue="LastName" >  <apex:outputtext value="{!c.cat.LastName}"  id="lOutname" styleclass="outval"/>
                                                <apex:inputtext value="{!c.cat.LastName}" id="linname" styleclass="inpval"/> 
        <apex:column headerValue="FirstName">   <apex:outputtext value="{!c.cat.FirstName}"  id="fOutname" styleclass="outval"/>
                                                <apex:inputtext value="{!c.cat.FirstName}" id="finname" styleclass="inpval"/>
        <apex:column headerValue="Department" >   <apex:outputtext value="{!c.cat.department}" id="Outdept" styleclass="outval"/>
                                                   <apex:inputtext value="{!c.cat.department}"   id="indept" styleclass="inpval"/>
        <apex:column headerValue="Edit/Save" > 
                                               <div id="editrow" onclick="editrow()"> Edit </div>  
                                               <div id="saverow"> Save </div> 


You can give a common class to all the output elements and a separate class to all the inputs and can show or hide either the outputs or inputs using the jQuery's class selector.

Vivek Shinde