Vote count:
0
If I do the following, then 0 and 2 are returned, respectively:
$html = $(document.createDocumentFragment());
$html.append('<a href="#">First link</a><a href="#">Second link</a>');
console.log($html.find('a').length);
console.log($html[0].querySelectorAll('a').length);
How can I make it so that the jQuery method will also work? So basically, I want to be able to search a document fragment with jQuery, rather than needing to switch back and forth with native JavaScript DOM functions.
asked 3 mins ago
Find elements in a jQuery document fragment with jQuery's "find"
Aucun commentaire:
Enregistrer un commentaire