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

  • SEARCH
  • Home
  • 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 8223295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:38:48+00:00 2026-06-07T14:38:48+00:00

apologies if this has been answered before, I couldn’t dig anything up when searching.

  • 0

apologies if this has been answered before, I couldn’t dig anything up when searching.

I am overriding jQuery validator’s highlight & unhighlight methods – but I wish to continue calling the ‘stock’ version of the methods also. In C# this would be like calling base.unhighlight, for example.

As it stands, I am forced to copy & paste code out of the original thus simulating a call to the parent.

jQuery.validator.setDefaults({
    unhighlight: function (element, errorClass, validClass) {
        // base.unhighlight(element, errorClass, validClass) // <-- desired functionality
    ...

How would I go about doing this? Thanks a lot–

  • 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-07T14:38:49+00:00Added an answer on June 7, 2026 at 2:38 pm

    With the way this is structured, that’s about the best you could do without modifying the plugin. The reason for this, is when you call the setDefault method, it overwrites the plugins own copy of the defaults. This proved hard to get around, but I fixed it by separating the defaults object out & and making a copy of it to refer back to. Honestly copying the simple logic from the plugin source might be the better route at this point, because you should only be calling setDefaults once for your entire implementation.

    See my commits here & here. Feel free to fork if you wish.

    Basically, now the function you’re calling has an extra param, _orig (or whatever you wish). Same goes for highlight.

    unhighlight: function (el, error, valid, _orig) {
      _orig(el, error, valid); // runs directly from the defaults.
      // do other stuff.
    }
    

    Here’s the file

    Edit: Wow. That plugin’s scope is waayy advanced. It took longer than I thought to implement my solution. Here’s a working demo: http://jsfiddle.net/fjMFk/24/

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

Sidebar

Related Questions

My apologies if this has been answered before or is obvious...did some searching here
Apologies if this has been answered before (I couldn't find the answer when I
Apologies if this has been asked before (I couldn't find the answer anywhere), but
Apologies if this has been answered before. I've been trying to construct an XPath
Apologies if this has been answered before, but I find it very difficult to
Apologies if this has been answered before or if it's too obvious - pointers
Apologies if this question has been answered before. Though the answers I've seen look
Apologies if this has been asked before. I searched and couldn't find it. In
Apologies if this has been answered before but I can't find a reference. I
First off, apologies if this question has been asked before but I couldn't find

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.