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
abc0551abc0551 

javascript to hide theapex input text field

hello all,

I am tryingto hide an input text field for a picklist value and show the same field for another picklistvalue. I want to get this function through javascript. I am trying to avoid hte usage of "getElementById". I could get this working on the vf attribute "styleclass". But i want to call the script from the attribute "id".

 

Here is my code.

<apex:inputText value="{!ConEmail.dealerCode}" id="DealerCode">

 here is javascript &colon;

 <script>                    
       function EventChanged(leadFormat) 
       {
           if (leadFormat.value == "XML-GM" )
           { 
				$("#DealerCode").show();
      			alert('IN IF');
           }
           else
           { 
      			$("#DealerCode").hide(); 
      			alert('IN ELSE');
      		}
       }
   </script>

 I can enter the if condition and get the alerts for "in if" and "in else" but somehow unable to hide or show the field.

Any input will be greatly appreciated.

<apex:inputText value="{!ConEmail.dealerCode}" id="DealerCode">

yvk431yvk431

Just check whether you missed any one of the steps mentioned in the knowledge base:

 

http://developer.force.com/cookbook/recipe/using-jquery-in-a-visualforce-page

 

 

--yvk