Is there an equivalient of the firstChild.data in JQuery?
Given the following HTML :
<p id='test'>Hello<span>world</span>/<p>
the below javascipt will return : “Hello”
document.getElementById('test').firstChild.data
the given JQuery will return : Hello< span>world</span>
$('#test').text()
how can I achieve this?
You want a text node, so you can make use of
.contents: