且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将 HTML 字符串附加到 DOM

更新时间:2021-11-08 04:38:34

使用 insertAdjacentHTML 其中 当前所有浏览器都支持:

div.insertAdjacentHTML( 'beforeend', str );

位置参数 beforeend 将添加到元素内部,在其最后一个子元素之后.

The position parameter beforeend will add inside the element, after its last child.

现场演示: http://jsfiddle.net/euQ5n/