Answer the question
In order to leave comments, you need to log in
Why is this the value of the property?
Why in the code below, "this" which inside "each" displays the value of the property of the object(e) ?
$('.someButton').on('click',function () {
console.dir(this);
$.each(this,function (e) {
console.log(e,this);
})
})
Answer the question
In order to leave comments, you need to log in
Perhaps you're asking why the property values for each .someButton object are displayed
?
If I understand the question correctly. Then in this case you have this which is passed as an argument to the first parameter of each - this is one of the .somrButton instances. and then you do this for this instance (this is an object with many sv you): for each property, print its values to me in console. Why is that? Because the this in each for an object is the values of each.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question