Bug solutions for Juqery Html (), append (), and other methods

Source: Internet
Author: User

I have Dynamically Loaded image hot zones in the past few days. I used Ajax to obtain the area tag. Here there are multiple areas, which can be tested normally in IE8 and FF, and ie6.

Later I found that the append method in jquery is not easy to add HTML to tags, and the following problems will occur.

First, give me the code to get the hot zone.

Below is the hot HTML
Copy codeThe Code is as follows:
<% = ViewState ["ID"] %> "width =" 930px "usemap =" # Map "border =" 0 "id =" NodeImage "/>
<Map name = "Map" id = "Map"> </map>

The result is as follows:

1. The correct code I want


 

2. Incorrect code

 

The above two results are from IETEST.

Previously, I used the $ ("# Map" ).html (); method to obtain the hot zone. The problem in Figure 2 can always occur.

Later I used alert ();After testing, the result is correct,You can solve the problem by using innerHtml () directly, that is, the line of Code that is commented out at the top.

In fact, sometimes Javascript is better compatible with some of its own things, depending on the needs. Jquery is not omnipotent!

This may be a Bug in jquery. It's just my personal opinion. It's for your reference only!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.