InterviewSolution
Saved Bookmarks
| 1. |
In jQuery, what is the difference between $(this) and this. |
Answer»
We use this as an alternative to this.parent() to refer to the parent object in JavaScript. This is more convenient than using this.parent(). We can also use this to refer to other elements in HTML, as in an ul element: var myElement = $('ul').each(function() {var childElement = this.parent().nextSibling(); }); This is useful when you need to iterate over a list of elements and their children, but you do not want to reference the parent object. |
|