innerText,innerHTML和值之间的区别? [英] Difference between innerText, innerHTML and value?
本文介绍了innerText,innerHTML和值之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
JavaScript中的 innerHTML
, innerText
和 value
有什么区别?
What is the difference between innerHTML
, innerText
and 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屋!
查看全文