innerText和innerHTML之间的区别 [英] Difference between innerText and innerHTML

查看:104
本文介绍了innerText和innerHTML之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

innerHTML innerText childNodes []之间有什么区别。值< JavaScript中的$ / c $ c>?

What is the difference between innerHTML, innerText and childNodes[].value in JavaScript?

推荐答案

innerText 不同,但是, innerHTML 允许您使用HTML富文本,并且不会自动编码和解码文本。换句话说, innerText 检索并将标记的内容设置为纯文本,而 innerHTML 检索并设置内容HTML格式。

Unlike innerText, though, innerHTML lets you work with HTML rich text and doesn't automatically encode and decode text. In other words, innerText retrieves and sets the content of the tag as plain text, whereas innerHTML retrieves and sets the content in HTML format.

这篇关于innerText和innerHTML之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆