impressionHtml=`<img src=${value} alt=""/>`;
document.getElementById("wrapper").appendChild(impressionHtml);
js向父元素wrapper中的末尾添加 定義好的html,報錯:html
Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
在stackoverflow上找到很好的一個解釋:jquery
因此js是不能直接傳入字符串的,可是jquery的append能夠直接傳入html字符串。app