Home >Web Front-end >JS Tutorial >Basic ideas and implementation code for dynamically deleting div elements in js_javascript skills
When doing user searches, because the search results need to be dynamically loaded and displayed, those html elements must be dynamically generated by Ajax. When the user opens the search interface, there are users recommended by the system. When the user searches according to conditions, the search results are dynamically loaded and displayed. So consider using js to do it. This for loop removes the existing form. Then dynamically generate new form objects based on the data requested by Ajax. Be sure to pay attention to the j variable looping from large to small, otherwise, deleting the div element will cause the length of serchResultLenth=serchResult.children.length; to change (this problem took a long time to figure out, remember)