html - Access normal text using jquery -
i have following html code:
<div class="top_l"> <a class="shou" onclick="" href="">11</a> | <img border="0" class="" src="/">xxxxxx<a href=""></a> | <a href=""></a> | <a href=""></a> </div>
how text xxxxxx using jquery(what selector used)?
you can select element nodes jquery. , jquery methods consider element nodes, using jquery , plain dom api might approach here.
the text node want target next sibling of image. if can reference image element, can access text node .nextsibling
[mdn] property:
var txt = image.nextsibling.nodevalue; // or if image jquery object var txt = image.get(0).nextsibling.nodevalue;
given structure of html, this:
var txt = $('.top_l > img').get(0).nextsibling.nodevalue;
Comments
Post a Comment