Home >Web Front-end >HTML Tutorial >html framework-multiple dialog boxes (same id) processing_html/css_WEB-ITnose
Most of the data on a website is refreshed asynchronously, which is nothing to say. Now there are many front-end and back-end frameworks. Everyone knows that frameworks are easy to use. You don’t need to write styles yourself, just use the syntax on the framework. It can produce beautiful dynamic effects, and when using a framework, most dynamic effects are generated dynamically. For example, take a dialog box. For example, if the homepage is a datagrid table display, then double-click to edit and enter Edit dialog box, and the data in this dialog box is dynamically generated, this is easy to handle, because there is only one layer of dependencies, so there will be no duplicate ID bugs in the code specification point, but if you In this editing dialog box, there is a function to select icons. The click event generates an icon selection dialog box. Sometimes the generated code will be very illogical, because you are obviously editing a dialog box. There is a dialog box loaded under the elements inside, but the html you see with the browser has gone under the body. Isn't this very depressing? Now your dynamic loading will click the edit dialog box without refreshing next time. It's okay. When you click the icon selection in the dialog box, it turns out that only the HTML under the parent element of the table was processed, but the elements under the body were not processed. However, the elements under the body cannot be processed entirely, otherwise the homepage will be gone, so After processing the elements in the table, you must also process the elements in the second dialog box, so that overlapping elements can be removed each time. As for how to deal with it, there are several methods, and direct removal is faster.
When I encountered this kind of problem before, I didn’t solve it in depth. Maybe some people would say to directly add a class to pop up, so that the ID will not be repeated. In this case, N dialog boxes will pop up at once. It didn't work. Then the solution I thought of was not to pop up repeatedly, but to refresh it directly after it is displayed. Don't pop it up again. This will not cause multiple ones to be generated, just like the table editing dialog box, because there is only one , it will not be closed after it is displayed. After it is closed, it will be processed again when it is opened, so this is no problem. But when the above problem comes, it will not be displayed forever and will not be closed, so this This method solved it for a while, but it didn't solve the problem fundamentally. I was in a good mood today, so I wrote a diary.