鏈接在這裏; http://heart.bmj.com/content/early/2016/08/10/heartjnl-2016-310003.long如何使用javascript獲取span內部的文本內容?
我有;
<span class="cit-title">
<span class="cit-series-title">Original article
<span class="cit-sep cit-sep-after-article-series-title">:</span>
</span>Pregnancy outcomes in patients with pulmonary arterial hypertension associated with congenital heart disease
</span>
到目前爲止我做了什麼?
我選擇span.cit-title
但它innerText
給我;
"Original article: Pregnancy outcomes in patients with pulmonary arterial hypertension associated with congenital heart disease"
我想只有
"Pregnancy outcomes in patients with pulmonary arterial hypertension associated with congenital heart disease"`
一部分。
如何排除類別爲cit-series-title
的跨度並獲取原始文本?
這是http://stackoverflow.com/questions/6520192/get-text-node-of-an-element的副本。你會在那裏找到你的答案。 – Max
是否真的需要很多跨度? – vamsi
我嘗試解析html。所以我不是跨度的作者。 :) – user6468132