innerText,innerHTML和childNodes []。value之间的区别? [英] Difference between innerText, innerHTML, and childNodes[].value?

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

问题描述

innerHTML innerText childNodes []。value <有什么区别? / code>在JavaScript中?

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和childNodes []。value之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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