例:
有时HTML是:
<div id="1">
<div id="2">
this is the text i do NOT want
</div>
this is the text i want here
</div>
Run Code Online (Sandbox Code Playgroud)
其他时候它只是:
<div id="1">
this is the text i want here
</div>
Run Code Online (Sandbox Code Playgroud)
我想只获取一个标签中的文本,并忽略所有其他子标签.如果我经营这家.text酒店,我会得到两个.