jQuery DOM node...LOGIN

jQuery DOM nodes and node properties

You can easily obtain DOM nodes through JavaScript to perform a series of DOM operations. But in fact, most developers are accustomed to defining the HTML structure first, but this is very inflexible.

Imagine this situation: If we can determine the structure after obtaining the data through AJAX, this situation requires dynamic processing of nodes

This article will introduce to you how to use JavaScript Creating a div node element mainly includes two parts: creating the attributes of the div node element and creating the style of the div node element. I believe that the introduction in this article will definitely help you gain something.

Creation of nodes

Creation process:                                                                                                                                                                                                                   

                                                                                                                                             

Next Section
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script> <script> $(function(){ var $li1 = $("<li>php中文网</li>"); //创建第一个li 标签 var $li2 = $("<li>php.cn</li>"); //创建第二个li 标签 $("ul").append($li1); //添加到<ul>节点中,<ul>节点是<li>的父节点 }) </script> </head> <body> <ul></ul> </body> </html>
submitReset Code
ChapterCourseware