Skip to content

Why is there no mention of elem.innerText? (or did I miss it?)  #1615

@paroche

Description

@paroche

Wouldn't it be good to at least mention elem.innerText along with elem.innerHTML and elem.textContent? Even if perhaps you don't favor using it, it will still be encountered in code, so it would be good to have at least a nodding acquaintance with it. Also, I would think it would be good to know anyway -- it has somewhat different properties than textContent in some contexts, showing more what the user would see (e.g. ignoring hidden text). As it says in the MDN doc: "Basically, innerText is aware of the rendered appearance of text, while textContent is not". Useful if, for instance, the text contains line breaks but you don't want to use innerHTML.

(If it is already covered somewhere I guess I missed it, but I did look; it's not in the 'Node properties...' article, or in "Modifying the document', plus I did a StartPage search for it on your site with no apparent results).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions