Javascript JQuery从Div减号子元素抓取文本

Javascript JQuery从Div减号子元素抓取文本,javascript,jquery,html,Javascript,Jquery,Html,有没有一种简单的方法可以在不获取任何子元素的情况下从这个div中获取文本 <div id="someselector"> <strong>Title Text Unwanted</strong> This is the text I need </div> 基本上可以归结为: $("#someselector").clone().children().remove().end().text(); 首先,克隆元素,获取其子元素,删除它们,

有没有一种简单的方法可以在不获取任何子元素的情况下从这个div中获取文本

<div id="someselector">
   <strong>Title Text Unwanted</strong> This is the text I need
</div> 

基本上可以归结为:

$("#someselector").clone().children().remove().end().text();

首先,克隆元素,获取其子元素,删除它们,然后获取克隆的文本

$('#someselector')[0].childNodes[0].nodeValue
这是有效的,谢谢,当时间约束从堆栈中完成时,我会接受这个答案
$("#someselector").clone().children().remove().end().text();