Here is my problem:
<html>
<div id="parentdiv">
some parent value
<div id="childdiv">some child value</div>
</div>
</html>
parent div --> parent div content --> child div --> child div content --> end child div --> end parent div
I need to acquire only parent div value, without child div value. How can I do that in Javascript?
try this:
alert($('#parentdiv').clone().children().remove().end().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