The HTML (data) method of jquery and the solution method of <script> script block _jquery
Source: Internet
Author: User
"Today we noticed jquery (...)." HTML () method returns HTML will filter out all the <script> blocks, but sometimes, especially in AJAX applications, often need to keep the <script> block in HTML, such as local update with script content, should not use HTML ( To read and write HTML, or to honestly use elem.innerhtml. I hereby give you a wake-up call today for 1 hours of wasted time. ”
After the test found, the new version of the (1.3.2, previous versions have not been verified) jquery (...). The HTML () method no longer exists (the HTML () method is an operation to read the DOM element data), but when writing data to a DOM element with the HTML method and the script in the data parameter, Another abnormal phenomenon: in Firefox (I use 3.6) browser to perform the above operation, the data parameters inside the script will automatically run, causing page disfigured, abnormal and other errors, For example, I encountered the problem is: in the script in the existence of the Document.Write method, after the completion of the HTML (data) operation of the entire page of the original DOM elements disappeared, leaving only the document.write () method of execution results, causing the page disfigured Specific reasons to be discussed, and finally to solve the problem with Elem.innerhtml=data this way, hereby marked.
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.