jquery node creation and processing of attributes create node

Source: Internet
Author: User

To create an element node:

There are several ways that you can get in touch later. It is common to give the structure of this node directly to the HTML tag string, which is handled by the $ () function, $ ("HTML structure")

$ ("<div></div>")

Create as this node:

Similar to creating element nodes, you can directly describe the contents of the text

$ ("<div> I am a text node </div>")

Create as Attribute node:

The same way you create an element node

$ ("<div id= ' test ' class= ' Aaron ' > I am a text node </div>")

We've transformed the previous code through jquery, as shown in the code on the right.

It's all done in one sentence, the same way you write HTML structure.

$ ("<div class= ' right ' ><div class= ' Aaron ' > dynamically create DIV element nodes </div></div>")
This is how jquery creates nodes, and lets us preserve the way HTML is structured, very simple, convenient and flexible

jquery node creation and processing of attributes create node

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.