Linked Questions
93 questions linked to/from What's the difference between '$(this)' and 'this'?
28
votes
3
answers
47k
views
this vs $(this) [duplicate]
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
Why do I have to use $(this)? [duplicate]
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) ...
Community wiki
13
votes
6
answers
29k
views
Jquery - When to use "this" and when to use "$(this)"? [duplicate]
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.
...
13
votes
1
answer
24k
views
Usage of javascript `this.closest` in IE11 and Chrome [duplicate]
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 ...
5
votes
6
answers
3k
views
What is the difference between jQuery "this" and JavaScript "this"? [duplicate]
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
user1899082
1
vote
5
answers
22k
views
$(this) vs this in JavaScript [duplicate]
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 ...
0
votes
4
answers
8k
views
what does $(this) mean in jquery [duplicate]
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Demo</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/...
3
votes
8
answers
357
views
jQuery "this" and element collection [duplicate]
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
Why we use $(this) in jquery [duplicate]
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>
...
1
vote
2
answers
500
views
this.css( "color", "green" ); (rather than $(this)) -- why does it work? [duplicate]
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 ...
-1
votes
4
answers
150
views
This difference [duplicate]
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);
$...
-2
votes
2
answers
541
views
what is difference between this.width & $(this).width with fancybox [duplicate]
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
can't test for input checked in each loop [duplicate]
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
Why $(this) is referring to a wrapped set instead of an individual element? [duplicate]
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
Mixing javascript and jquery [duplicate]
$(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 ...