just getting myself familiar with jquery, please consider me as a noob for now.
I am trying to select text in this follow scenrio:-
<div id="blah">
<p> <span>Text1</span> text2</p>
</div>
How can I get the value of text2 ?
Thank you
If you want the text of entire p
tag use:
var text = $("#blah p").text();
Otherwise if you want to exlude the span
part, then use:
var text = $("#blah p").contents(":not(span)").text();
Your text will now be stored in the variable named text
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With