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 8382823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:00:55+00:00 2026-06-09T17:00:55+00:00

What happens when I want to refer to this in nested statements, which this

  • 0

What happens when I want to refer to “this” in nested statements, which “this” does it use?

Here’s an example to show what i mean by the above:

    $("input").blur(function(){
            var theThis = $(this);
            if(!($(".invalid").length > 0)){
                //if there's no messages already open
                theThis.data("validator").checkValidity();
            }else{
                //add the message to the next to be displayed
                nextToAlert.push(theThis);
                //bind an event to the errored field being changed
                $(".invalid").on("change", function(){
                    var me = $(this);
                    if(!me.hasClass('invalid')){
                        nextToAlert.pop().checkValidity();

                    }
                });
            }
    });
  • 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-09T17:00:56+00:00Added an answer on June 9, 2026 at 5:00 pm

    In your code:

    • theThis refers to $("input")
    • me revers to $(".invalid")

    $(this) will always change depending on the current scope.

    When you use any sort of action-binding function such as blur, on, bind, live, etc, then $(this) will refer to the current jQuery object that the event is being bound to.

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

Sidebar

Related Questions

I want to know what actually happens when you annotate a method with @Transactional
I want to know what happens when I create an instance of a ServiceHost
Because wikipedia is open source, I can modify anything I want. But what happens
Here is what I want to happen: The user should click a link/button that
I want this: http://jqueryui.com/demos/dialog/#modal-message to happend when you click on ClickMe. how to do
If you take a look at this jsfiddle example: http://jsfiddle.net/2YbpZ/ You can see that
How does the following example usage of extern specifer behave. We have a global
I am loading names/grades from a database which happens perfectly... however, the grade assosciated
I have an NSArray output. please refer below. I want to sort based on
I am working on a new PHP project now, this time I want to

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.