What's the difference between .clone() and .html()?

前端 未结 5 538
广开言路
广开言路 2021-02-05 15:03

What is the difference between Jquery\'s .clone() and .html() functions?

Jquery documentation states:

The .clone() method performs a deep copy of

5条回答
  •  别那么骄傲
    2021-02-05 15:58

    from the quoted sentences you posted above the answer is there:

    .clone()it copies the matched elements as well as all of their descendant elements and text nodes. means it select all the elements within the selector.

    while .html() it only selects the first element.

提交回复
热议问题