I know you mentioned that you used filter
instead of find
, however, that should work. jQuery is stripping out the html
, head
,body
tags, etc. Once this is done, #holder-1
is now at the top level of the hierarchy.
This fiddle demonstrates that filter
does work:
var html = '<!doctype html><html dir="ltr" lang="pt-BR"><head> <meta charset="UTF-8"> <title>Return Test</title></head><body> <div id="holder-1"> <h1>Content 1</h1> </div> <div id="holder-2"> <h1>Content 2</h1> </div> <div id="holder-3"> <h1>Content 3</h1> </div></body></html>';
alert($(html).filter("#holder-1").html());