How to append div inside other div

后端 未结 5 1651
北荒
北荒 2021-01-26 03:37

I want to append div inside mytext div but it is updating text outside of the div




        
5条回答
  •  情书的邮戳
    2021-01-26 04:08

    var myDiv = $('
    '); myDiv.append('
    min
    '); $('body').append(myDiv);

    The append function doesn't append html to the document. It appends elements to the document object tree.

    You could, however, just write this on one line like this, if you wish.

    $('body').append('
    min
    ');

    Boom.

提交回复
热议问题