javascript - jQuery: Get inner HTML from a HTML code within a variable -


i have variable contains html element:

alert(adata[3]); 

gives me:

bla bla bla <div style="display: none">  <table>....</table> </div> 

i'm trying figure out how contents within div-tag variable adata[3] via jquery. tried various things:

elem = $(adata[3]).find("div"); alert(elem.html());  // or elem = $(adata[3]).find("div"); alert(elem[0].html());  // or elem = $(adata[3]).find("div"); alert($(elem[0]).html());  // or elem = $(adata[3], 'div'); alert(elem.html()); 

can't of work. how correct version? :( lot

find looks descendants of elements in jquery object, div highest level element in html (it isn't descendant of anything).

just don't use find.

elem = $(adata[3]); alert(elem.html()); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -