DOM Properties and attributes

Source: Internet
Author: User

Recently made an HTML to PDF project, the middle of the user interactive HTML, and the interactive HTML results converted to PDF, but the first encounter a problem,

That is, whether it is the Val () or the DOM of jquery. Value is always unable to assign a value to the page's document (that is, the console's HTML code) just on the surface.

The DOM in the original browser is divided into attributes and attributes, which refers to the properties of the DOM object in the current browser, which refers to a plain HTML document,

I want to take HTML, of course, to change the text of the HTML document, and not just to let the user see the properties, generally do not have to HTML when the difference between the two.

And, after the page has been generated by the browser, from the perspective of value, these two are basically unrelated, you change that side, the other side is unchanged. What other style?

The property says otherwise. In summary, if you want to change the DOM object and HTML document, if using jquery must be Val () and attr () a piece, if the change is pure JS

, JS's Dom object has a attributes feature, in which the face changes to modify the HTML document.

Use pure JS for an example

If you only assign a value to a DOM object's properties Obj.value then the textbox's surface values and DOM object properties are changed, but the HTML document does not change

Only attributes-assigned HTML documents will change

The JQ is not written, it's a attr and Val.

DOM Properties and attributes

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.