How to create an empty, non-null jQuery object ready for appending?

后端 未结 6 1937
傲寒
傲寒 2021-02-06 21:04

I want to append some html to an empty non null jQuery object only in the loop but it\'s not working unless I create an object and add an html tag during creation. How can I cre

6条回答
  •  旧时难觅i
    2021-02-06 21:29

    if you don't want to end up with an ugly tag:

    if(!$new){
    $new.append("");
    } else {
    var $new = $("");
    

提交回复
热议问题