如何将其作为字符串而不是 html 元素返回?
<script>
function myFunction() {
var str = "<input type='text'/>";
var res = str.toString();
document.getElementById("demo").innerHTML = res;
}
</script>
最佳答案
尝试使用 textContent
而不是 innerHTML
。
关于javascript - 如何将其作为字符串而不是 html 元素返回?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43578984/