Description: Function: Slide down to load more, request data through ajax and insert the assembled html template into the list. Implementation: Insert an html template into the .list through the $(‘.list’).append(‘_html’); method. However, after triggering the load more times, it is found that the append() method executes slower and slower. Solution: After investigation, it was found that .l also exists in the _html template to be inserted."/> Description: Function: Slide down to load more, request data through ajax and insert the assembled html template into the list. Implementation: Insert an html template into the .list through the $(‘.list’).append(‘_html’); method. However, after triggering the load more times, it is found that the append() method executes slower and slower. Solution: After investigation, it was found that .l also exists in the _html template to be inserted.">

Home >Web Front-end >JS Tutorial >Problems in using Jquery append method

Problems in using Jquery append method

一个新手
一个新手Original
2017-09-25 10:17:142617browse

Simple example:

<p style="margin-top: 5px;">//html<p class="answer"></p><br/></p>

Description:
Function: Slide down to load more, request data through ajax and insert the assembled html template into the list.
Implementation: Insert an html template into the .list through the

$(&#39;.list&#39;).append(&#39;_html&#39;);

method. However, after triggering the load more times, it is found that the append() method executes slower and slower.

Solution: After investigation, it was found that the .list class also exists in the _html template to be inserted. Therefore, after multiple insertions, execute $('.list').append( '_html');, $('.list') will take longer and longer.

The above is the detailed content of Problems in using Jquery append method. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn