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
Sravani SBSravani SB 

error meage using jquery or javascript

 $(document).on('click','.f',function(){
        alert('Happy New Year');
       var status1 = $('.b').val();
       alert('status'+status1);
                    if(status1=="open") {
                        alert('status'+status1);   
                            $('.b').text("Status Field Should not be Open");
                        }
                    });
            <apex:commandButton value="Save" action="{!save1}" styleClass="f"/>
            <apex:inputField value="{!a.Status__c}"  styleClass="b"/>
 
Best Answer chosen by Sravani SB
Sravani SBSravani SB
I should want to display mesage by using jquery

All Answers

NagendraNagendra (Salesforce Developers) 
Hi Sravani,

You can use apex:pageMessage to display the individual message on VF page
This is a kind of static message which you will write in Visualforce itself and can put some conditions in rendered attribute to display the message.
<apex:pageMessage id="mymessage" severity="Error" summary="First Error message on page" strength="1"></apex:pageMessage>
This would render to
User-added image
severity can be anything from 'confirm', 'info', 'warning', 'error'.
This will render below html code
<div id="page:mymessage:j_id0:j_id2" class="messageText"> <span id="page:mymessage:j_id0:j_id3"> <h4></h4> </span> First Error message on page<br> </div>
Html Id can vary according to your code.

You can easily manipulate this code using jQuery and HTML Id.
Example
$("[id*=page:mymessage]").each(function() { this.style.display = "none"; });
For more information please refer to below link. Hope this helps.

Kindly mark this as solved if the reply was helpful.

Thanks,
Nagendra
Sravani SBSravani SB
I should want to display mesage by using jquery
This was selected as the best answer