I am trying to parse this html through jQuery to get data1, data2, data3. While I do get data2 and data3 I am unable to get data3 with my approach. I am fairly new to jQuery
I don't know any other way than placing the HTML in an temporary invisible container.
$(document).ready(function(){
var datahtml = $("data1
data2
data3
".replace("\\", ""));
var tempContainer = $('');
$('body').append(tempContainer);
alert($(tempContainer).find('.class1').text());
$(tempContainer).remove();
});
Here is a jsfiddle demo.