--- title: Node.innerText slug: Web/API/HTMLElement/innerText translation_of: Web/API/HTMLElement/innerText original_slug: Web/API/Node/innerText ---
Node.innerText
是一個代表節點及其後代之「已渲染」(rendered)文字內容的屬性。如同一個存取器,Node.innerText
近似於使用者利用游標選取成高亮後複製至剪貼簿之元素的內容。此功能最初由 Internet Explorer 提供,並在被所有主要瀏覽器採納之後,於 2016 年正式成為 HTML 標準。
{{domxref("Node.textContent")}} 屬性是一個相似的選擇,但兩者之間仍有非常不同的差異。
Specification | Status | Comment |
---|---|---|
{{SpecName('HTML WHATWG', 'dom.html#the-innertext-idl-attribute', 'innerText')}} | {{Spec2('HTML WHATWG')}} | Introduced, based on the draft of the innerText specification. See whatwg/html#465 and whatwg/compat#5 for history. |
{{ CompatibilityTable() }}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 4 | {{ CompatGeckoDesktop(45) }} | 6 | 9.6 (probably earlier) | 3 |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | 2.3 (probably earlier) | {{ CompatGeckoMobile(45) }} | 10 (probably earlier) | 12 | 4.1 (probably earlier) |