javascript - Find elements inside Data object of jQuery .get() -
i thought easier find :)
$.get('/page.html', function(data) { //get contents of class="contents" }); i can't seem find out how that.
i this...
$.get('/page.html', function(data){ var $page = $(data) var $contents = $page.filter('.contents'); /* reference .contents */ /* more stuff here .... */ }); have @ accepted answer so: get html of div element returned .get jquery
if structure of returned content uncertain (to need use .find() due .contents being descendent, perform check , run .filter() or vice versa.
example:
$contents = $page.filter('.contents'); if($contents.length == 0) { $contents = $page.find('.contents'); } just thought based on comments posted in other answers.
Comments
Post a Comment