I'm inserting a snippet of HTML through .get, and the new HTML when inserted (using .append) will have an <li>
element with an id attribute I need. Any way of getting a reference to the last inserted element, 开发者_JS百科and query from there, perhaps? Any good ideas?
$(yourhtml).find('li:last').attr('id');
You can also use the :nth-child selector.
$("li:nth-child(3)").attr('id'); //selects the third, as an example
http://api.jquery.com/nth-child-selector/
精彩评论