How to find element in html string jquery‏



Created: 25/04/2015 08:25:13 a.m.







How to find element in html string jquery‏


Use parseHTML from jquery 1.8 and above

https://api.jquery.com/category/version/1.8/


var str = '<div id="div1">div one</div><div id="div2">div two</div>';
var html = $.parseHTML(str);
alert($(html).filter('#div1').text());

 
http://api.jquery.com/filter/









Comments:


Go to Comments