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