Problem
You have just manipulated a set of elements in order to acquire a new set of elements. However, you want to operate on the prior set as well as the current set.
Solution
You can combine a prior selection of DOM elements with the current selection by using the and Self() method. For example, in the following code, we are first selecting all <div>elements on the page. Next we manipulate this set of elements by finding all <p>elements contained within the <div>elements. Now, in order to operate on both the <div>and the <p>elements found within the <div>, we could include the <div>into the current set by using and Self(). Had I omitted the and Self(), the border color would have only been applied to the <p>elements:
Discussion
Keep in mind that when you use the and Self() method, it will only add into the current set being operated on and the prior set, but not all prior sets
|
|
J Query Related Interview Questions |
|
---|---|
HTML 4 Interview Questions | HTML Interview Questions |
HTML 5 Interview Questions | Zend Interview Questions |
PHP and Jquery Interview Questions | HTML+Javascript Interview Questions |
J Query Interview Questions | Javascript Objects Interview Questions |
Javascript Advanced Interview Questions | CodeIgniter Interview Questions |
JqueryUI Interview Questions | Dynamic HTML Interview Questions |
XQuery Interview Questions | jQuery Mobile Interview Questions |
JSON (JavaScript Object Notation) Interview Questions | Advanced jQuery Interview Questions |
J Query Related Practice Tests |
|
---|---|
HTML 4 Practice Tests | HTML Practice Tests |
HTML 5 Practice Tests | Zend Practice Tests |
PHP and Jquery Practice Tests | J Query Practice Tests |
CodeIgniter Practice Tests | Dynamic HTML Practice Tests |
JSON (JavaScript Object Notation) Practice Tests | Advanced jQuery Practice Tests |
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.