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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:12:59+00:00 2026-06-06T11:12:59+00:00

Can someone let me know what is the difference between this and jQuery(this) ?

  • 0

Can someone let me know what is the difference between this and jQuery(this)? I found that my code works if I use ‘this‘ and if I use jQuery(this) it does not work. Does jQuery(this) not query for the current object and return it?

I want to know the index of the image being clicked ( I now we have the index() method, but still want it through the below logic)
Here is the full code:(edited as per request)

for(i=0;i<5;i++)
{
jQuery("#div1").append("<img src='slider.jpg'>");
}
imgArr=jQuery("#div1>img");
jQuery("#div1>img").click(display);
function display()
{
  for(i=0;i<imgArr.length;i++)
  {
     if(this==imgArr[i])
     {
      alert(i);
     }
  }
}

Here if I replace this with jQuery(this) it does not work.

  • 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-06T11:13:00+00:00Added an answer on June 6, 2026 at 11:13 am

    I suppose “this” is a reference to a DOM element in your first example?

    jQuery(this) is actually a jQuery wrapper around one or more DOM elements. So when you compare to a DOM element, it will never be equal.

    If you want the DOM element from a jQuery wrapper, use the indexer to get the first element:

    jQuery(this)[0] === this
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone let me know the difference between deleteJob() and unscheduleJob() of quartz 1.8.5?
The ASP.NET validation does not seem to work inside ASP:FormView. Can someone let me
Can someone please let me know how to get values from several input fields?
Can someone please let me know the location to get the Java7 from IBM
Can someone provide a simple example of how to properly use Html.RadioButtonFor? Let's say
Hoping someone can clear this up for me. Let's say I have 2 globals:
Can someone tell me why this processes all the files and then does it
Can someone please let me know how to get the different segments of the
Let me start off by saying I know this is probably not the correct
can someone let me know What is a non-delegating constructor ? I tried 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.