Home  >  Article  >  Web Front-end  >  Good way to create a new node object (custom structure/content) with jquery_jquery

Good way to create a new node object (custom structure/content) with jquery_jquery

WBOY
WBOYOriginal
2016-05-16 17:43:221148browse
HTML
Copy code The code is as follows:





JsBin-Online js/css debugging tool






Hello OSTools





JavaScript
Copy code The code is as follows:

//jq creates a new node object;
//For example:
var objNewDiv = $('< ;div>',{'id':'mydiv','class':'menu'});
objNewDiv.html(123456);
$('#hello').append(objNewDiv);
console.log(objNewDiv);

Result:
Good way to create a new node object (custom structure/content) with jquery_jquery
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn