When doing user searches, because the search results need to be loaded and displayed dynamically, 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 the conditions, the search results are loaded and displayed dynamically. So consider using js. This for loop is to remove existing forms. Then, based on the data requested by Ajax, a new form object is dynamically generated. Be sure to pay attention to the loop from large to small, otherwise, after deleting the div element, it will cause serchResultLenth=serchResult.children.length; length change (I have been exploring this problem for a long time before I get it done, remember)
The code copy is as follows:
for(var j=serchResultLenth-1;j>=0;j--){
var serchChild=document.getElementById(serchResult.children[j].id);
serchResult.removeChild(serchChild);
}