Home >Web Front-end >JS Tutorial >Bug solutions for Juqery Html(), append() and other methods_jquery
In the past few days, I have been working on dynamically loading image hotspots. I used Ajax to get the area tag. There are multiple areas here. The test is normal in IE8 and FF, but once it is in IE7 and IE6, the display is abnormal.
Later I found that the method of append in jquery to add HTML to tags is not easy to use, and the following problems will occur
First give me the code to get the hot zone
The following is the hot HTMLHere are the results:
1. The correct code I want
2. Incorrect code
The above two results are screenshots from IETEST.
Previously I used the $("#Map").html(); method to obtain the hot area, but the problem in Figure 2 kept appearing.
Later I tested it using alert();, and the result was no problem. The problem was solved by directly using innerHtml(), which is the line of code commented at the top.
In fact, sometimes some things in JS itself are more compatible, depending on the needs. Jquery is not omnipotent!
This may be a bug in jquery. It’s just a personal opinion and is for reference only!