Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7865203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:00:58+00:00 2026-06-03T00:00:58+00:00

I have the folliwng code working, however I feel that there is a cleaner

  • 0

I have the folliwng code working, however I feel that there is a cleaner way of writing it.

<script type="text/javascript">     
    $(document).ready(function () {        
        $("#formRequest").validate({
            highlight: function (element, errorClass) {
                $(element).addClass("rfvTB");
            },
            unhighlight: function (element, errorClass) {
                $(element).removeClass("rfvTB");
            } 
        });

        $.validator.messages.required = '  *';
    }); 
</script>

the validation message seems like it belongs within the validate function. Is there a way of writing this cleaner?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T00:00:59+00:00Added an answer on June 3, 2026 at 12:00 am

    There isn’t a wonderful way to do that without a bunch of statements inside your validate object:

    You can specify the messages option in validate, and then for each required element, add a required: '*', like this:

    $('#formRequest').validate({
       //your options
       messages: {
          formElementName1: {
             required: '*'
          },
          //repeat for each form element
       }
    });
    

    If you have a lot of elements, this is pretty tedious and I would prefer your method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have follwing JSON: {mykey:[{name:Jak,interests:movies}]} and following opensocial app code: <script type=text/os-template require=mykey> <ul>
I have the follwing code (which is not working): private void Window_PreviewKeyDown(object sender, KeyEventArgs
I have the follwing code that provides an auto refresh feature to a WCF
I have the follwing code inside a facelet page: <h:inputNumber value=bean.property> <f:convertNumber type=currency />
I have the folliwng JSON request code on an ASP.NET MVC web application: var
Follwing code that i have tried doesn't display any thing. Test1.aspx protected void Button1_Click(object
i have the following code that won't compile because of generic problems. It comes
I have the follwing code where moreButton is a QPushButton . When I toggle
I have downloaded follwing code from one of Google Codes but problem is in
I have the follwing code. I want to get the value of the selected

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.