Use Jquery Selectors on $.AJAX loaded HTML?

One note I will add which is from a similar problem on here is that if your AJAX returns the following:

<div class="test">Hello</div>
<div class="one">World</div>

The following jQuery Won’t work:

$(data).find('div.test');

as the divs are top level elements and data isn’t an element but a string, to make it work you need to use .filter

$(data).filter('div.test');

Leave a Comment

tech