$new
Create an element with a set of attributes.
$new( tagName, properties )
tagName [string]
The tag name of new element.properties [object]
The properties name and value for new element.
Notes
This function is useful to create a new element for DOM insertion or other usage.
Example
HTML code
<div id="box_wrap"></div> <button onclick="start_create()">Insert new image element</button>
CSS code
#box_wrap {
width:300px;
font-size: 12px;
background: #eee;
border: 4px solid #333;
padding: 10px;
}JavaScript code
function start_create()
{
$append( $("box_wrap"), $new( "img", {
"src": "https://www.google.com/intl/en_com/images/srpr/logo3w.png",
"id": "content-image",
"title": "This is an image"
}));
}