Home > Web Front-end > JS Tutorial > body text

How to write innerText in both Firefox and IE browsers_javascript skills

WBOY
Release: 2016-05-16 18:06:43
Original
969 people have browsed it

The text-getting method innerText in IE is not supported in Firefox
firefox has been changed to the textContent method/property

and the whitespace characters in the middle of the text are ruthlessly replaced in Firefox
when used Exceptionally inconvenient
Now it’s okay, the innerText method has been redefined in Javascript
so that the innerText method can also be used in Firefox
and this method solves the problem of whitespace characters in firefox

Use Method:
Place the following script in the page
No matter IE or Firefox, you can use obj.innerText to extract text

Copy the code The code is as follows:


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template