I have this page block section code:

<apex:pageBlockSection id="contactData" columns="2" collapsible="true" >
   <apex:outputText label="First Name" value="{!p.FirstName}"           id="contFN"/>
   <apex:outputText label="Mailing Street" value="{!p.MailingStreet}"       id="contMailingStreet"/>
//...many more outputTest

There is a method on JS that I need to empty all the output Texts. I tried styleclass to put an empty value to each output Text but it doesn't work. How should I do it? like $('.contactFields').val(''); wont work here. Is there any other way?

  • Why don't you use apex:inputfield or apex:inputText if you want to clear those values.
    – Reshma
    Sep 5, 2018 at 6:53

1 Answer 1

//try something like this answer https://salesforce.stackexchange.com/a/172721/10073

    function clearValues() {
            document.getElementById('contactData:contFN').value = '';
            document.getElementById('contactData:contMailingStreet').value = '';


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .