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 > Article > Web Front-end > Problems in using Jquery append method
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
$('.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 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!