How to use jQuery methods to examine the DOM

Sometimes Web developer needs to receive an object and to find all the spans inside it. The best way to find items is to wrap the object inside a jQuery object and then use the find method to pass in a string query:


If obj is the JavaScript document object, this statement retrieves all the spans in the page.

Web developer can find check boxes that have been selected in a list, by encapsulating element in a jQuery object and then use the query illustrated in the article “How to query the DOM using jQuery”.
Web developer can find all the children of the treeview starting from the tree element, by using find method.


In this case the find method searches recursively between the children, but if Web developer needs only direct children, he/she has to use the children method:


Web developer can use parent method when he/she needs parent element of the object:


When Web developer passes a string to the $ method, he/she performs a query. When he/she passes an object, it’s included in a jQuery object that he/she can then query using methods.

If you want to host ASP.NET AJAX application then you will need ASP.NET AJAX hosting provider which supports AJAX Framework.