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 

How to display error messages using jquery

<script>
    $(document).ready(function(){ 
$('.f').Click(function(){
        alert('Happy New Year');
       var status1 = $('.b').val();
                    if(status1=='open') {
                        alert(status1);   
                            $('.b').text("Status Field Should not be Open");
                        }
                    });});
 <apex:commandButton value="Save" action="{!save1}" styleClass="f"/>
Khan AnasKhan Anas (Salesforce Developers) 
Hi Sravani,

Greetings to you!

Please refer to the below links which might help you further with the above requirement.

https://th3silverlining.com/2010/03/02/visualforce-form-validation-enhanced/

http://sfdcsrini.blogspot.com/2016/04/jquery-validatior.html

http://cloudyworlds.blogspot.com/2015/11/using-jquery-with-slds-for-validation.html

https://salesforce.stackexchange.com/questions/120794/adding-error-message-to-input-text-using-javascript-jquery-in-visualforce

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas