jQuery: append() vs appendTo()

后端 未结 3 869
礼貌的吻别
礼貌的吻别 2021-02-11 16:58

I am testing jQuery\'s .append() vs .appendTo() methods using following code:

$(\'div/>\', {
    id : id,
    text : $(this).text()
         


        
3条回答
  •  爱一瞬间的悲伤
    2021-02-11 17:21

    append appends the parameter to the object you're working on.

    appendTo appends the object you're working on to the parameter.

    More info here: http://api.jquery.com/appendTo/

    aside from that, there is something wrong here:

    $('div/>',
    

    this is not selecting anything.

提交回复
热议问题