P粉1484347422023-08-25 09:11:57
You can use the following method to get the nodeValue of the first child node
$('.title')[0].childNodes[0].nodeValue
P粉2391642342023-08-25 00:26:46
var text = $(".title").contents().filter(function() { return this.nodeType == Node.TEXT_NODE; }).text();
This takes the content
of the selected element and applies the filter function to it. The filter function returns only text nodes (i.e. those with nodeType == Node.TEXT_NODE
).