jQuery add elements to empty selection?

后端 未结 9 1493
一向
一向 2020-12-29 18:52

Why doesn\'t this work?

var spans = $();
var elem = document.getElementById(\'someId\');
spans.add(elem);

What is the proper way to start

9条回答
  •  渐次进展
    2020-12-29 19:47

    Try

    var spans = $("");
    var elem = $("#someId").html();
    spans.append(elem).appendTo('#someAnotherId');
    

    instead

提交回复
热议问题