textContent

Jump to: navigation, search

textContent


W3C Recommendation

Summary

Sets or retrieves the text content of a node and any child nodes.

Property of dom/Node

Syntax

var textContent = node.textContent;
node.textContent = newText;

Return Value

Returns an object of type String.

The text content of a node and its child nodes, if any.

Needs Examples: This section should include examples.



Related specifications

Specification Status Related Changes
DOM Level 3 Core Recommendation Section 1.4

Compatibility

Desktop

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic Support 1
Supported (when?)
9
?
Supported (when?)

Mobile

Feature Android BlackBerry Chrome for mobile Firefox Mobile (Gecko) IE Mobile Opera Mobile Opera Mini Safari Mobile
Basic support ? ? ? ? ? ? ? ?


Compatibility notes

Browser Version Note
Internet Explorer 8 and earlier Supported a similar functionality using the innerText property.

See also

Related pages (MSDN)

  • a
  • applet
  • attribute
  • audio
  • button
  • div
  • document
  • documentType
  • ProcessingInstruction
  • frame
  • iframe
  • img
  • input type=button
  • input type=checkbox
  • input type=file
  • input type=hidden
  • input type=image
  • input type=password
  • input type=radio
  • input type=reset
  • input type=submit
  • input type=text
  • label
  • legend
  • marquee
  • media
  • object
  • optGroup
  • option
  • select
  • source
  • span
  • table
  • textArea
  • TextNode
  • video

This article contains content originally from external sources.

Portions of this content come from the Microsoft Developer Network: [Windows Internet Explorer API reference Article]