Your selected objects in jQuery are returned as a jQuery object that maintains a reference to the DOM node. This is different from objects returned by the
document selectors. Therefore, jQuery provides its own methods for working with your selected results. Chief among them are
.html() method returns the HTML inside the selected element. If more than one element is in your results, only the HTML contained inside the first element is returned. As an example, the following selection returns all the
<li> items inside the
<ul> in Listing 18.1.
var sel = $('#navbar').children('li');var ht = sel.html();
However, the call to
.html() in the preceding code returns ...