Why does call to jQuery's appendChild fail with undefined error?

前端 未结 3 1159
鱼传尺愫
鱼传尺愫 2021-01-12 03:02

Here is my simple HTML:


    
Hello World!

Here is

3条回答
  •  佛祖请我去吃肉
    2021-01-12 03:12

    Use .append()

    newDiv.append(newSpan); 
    

    .appendChild() works with DOM element. newDiv is jQuery Object not a plain JavaScript DOM element.

    Working Fiddle

提交回复
热议问题