Linked Questions

28 votes
3 answers
47k views

Possible Duplicate: jQuery $(this) vs this I'm new to this and trying to get my concept right. There has been many instances of the use of "this" and "$(this)". Can someone please explain the ...
17 votes
5 answers
2k views

Possible Duplicate: jQuery $(this) vs this In jquery sometimes I find that within a function I have to use $(this) because this won't work: var listItems = $('li'); listItems.each(function(index) ...
13 votes
6 answers
29k views

Possible Duplicate: jQuery $(this) vs this What is the difference between "this" and "$(this)"? How do I know which one to use? Related, I think: With each, you have the optional parameters. ...
Buttle Butkus's user avatar
13 votes
1 answer
24k views

In IE11 the below code shows the following error, But it is working in Chrome Object doesn't support property or method 'closest'4:31 PM 09/07/16 assetTable.on("click", "td.clickProgress", function ...
Vijai's user avatar
  • 2,545
5 votes
6 answers
3k views

I am reading a jQuery book and sometimes I see the example like: $('img[alt]').each(function(){ $(this).replaceWith('<span>' + $(this).attr('alt')+ '</span>') } and sometimes I see ...
user avatar
1 vote
5 answers
22k views

When writing JavaScript in jQuery is it best to do: $('.select').click(function(e){ $(this).something(); //Or this.something(); }); Is there any difference? What are the advantages or ...
bizzehdee's user avatar
  • 21.2k
0 votes
4 answers
8k views

<!doctype html> <html> <head> <meta charset="utf-8" /> <title>Demo</title> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/...
user2294256's user avatar
  • 1,049
3 votes
8 answers
357 views

In this piece of code: $(function() { $("div").click(function() { $(this).before("<p>Hi</p>"); }); }); What does 'this' actually refer to? Does it ...
frrlod's user avatar
  • 6,777
2 votes
4 answers
721 views

i've been searching that why we use $(this) in jQuery . so i thought to ask it on stackOverFlow , i'm new to jQuery and i'm very curious to know about $this. <h1>Example Header</h1> ...
Daniel's user avatar
  • 1,476
1 vote
2 answers
500 views

I've been confused on the difference between this and $(this). Looking into it, I found this succinct explanation which has worked for me for a while, but then I ran into the following in this ...
dcgenjin's user avatar
  • 1,108
-1 votes
4 answers
150 views

Possible Duplicate: jQuery $(this) vs this This code in this video Tutorial in a Very useful blog jquery for designers $('.navigation').each(function () { var $links = $('a',this); $...
Tarek Saied's user avatar
  • 6,636
-2 votes
2 answers
541 views

I am a bit confused about the usage of this and $(this). Let's take the following example: $('a.thmb')click( function() { var img_url = $("img",this).attr("src"); $("#preview_img").attr( "src", ...
1 vote
1 answer
87 views

I have a simple object of input checkbox elements and want to check in an each loop which ones are checked and the do stuff. The checkboxes are in one tr in several td's in a table. Here is my code: ...
1 vote
3 answers
128 views

In this function, template.find('.userPhoto img').error(function () { $(this)[0].src = '/images/default.png'; }).attr('src', image); I was expecting $(this) to refer to an individual element, ...
Ariel's user avatar
  • 5,860
0 votes
1 answer
194 views

$(this).append('hello'); The above could be a line nested in some function of jquery. I know that this is a correct line, but I was wondering whether you could mix javascript with jquery and write it ...

15 30 50 per page
1
2 3 4 5
...
7