Extract part of html with jQuery -
on alerting of these
var htmldata = theparent.html();
i have getting result
<!--<div id="megamenu_part2"> <div class="first_rowtitle" id="megamenu_part2-in"><h6><a href="/news/159">one is</a></h6> <div class="mochu_newstile"> <span><img src="images/megamenu-icon_01.png"></span><span class="viewnumber_countfirst2">250</span> <span><img src="images/megamenu-icon_line.png"></span> <span><img src="megamenu-icon_comment.png"></span><span>0</span> </div> </div>-->
after use of jquery want html() of class = 'viewnumber_countfirst2' how can ?? var childht = $(htmldata).$('.viewnumber_count_sh').html()
work????
try:
var result = [] var htmldata = theparent.contents(); // return every dom element inside theparent, including text , comment htmldata.each(function(){ // each node, text , comment inside theparent current_content = $(this) if (current_content.nodetype == 8) { // if current content html comment current_content.find('.viewnumber_countfirst2').each(function(){ // event inner node of desired class: store html result.append($(this).html()); }); } });
Comments
Post a Comment