Started

Selectors

Utilities

Animation

AJAX

CSS

Event

Manipulation

Cookie

String

Attributes

Data

Storage

Miscellaneous

$dom

Continuously manipulate the matched DOM object
$dom( dom, callback )
  1. dom [object/array]
    The independent DOM object or the array containing DOM objects.
  2. callback [function]
    The callback function for each matched DOM objects.

Notes

This function is good for continuously manipulating the DOM object for better performance and better code construction.

Example

HTML code
<div id="classbox_wrap">
<div class="box">This is the box with box className</div>
</div>

<div id="box_wrap">
<div id="box1">This is the box with id 'box1'</div>
<div id="box2">This is the box with id 'box2'</div>
<div id="box3">This is the box with id 'box3'</div>
</div>

<button onclick="select_dom()">select dom</button>
CSS code
#classbox_wrap,
#box_wrap {
	border: 1px solid #ccc;
	margin: 10px 0;
	padding: 5px;
}

.box,
#box_wrap div {
	width: 150px;
	height: 80px;
	margin: 10px 0;
	font-size: 12px;
	background: #5599bb;
	padding: 10px;
}
JavaScript code
function select_dom()
{
	var new_elem = $new("div", {
		"className": "box",
		"text": "This is a new box"
	});

	$append($("classbox_wrap"), new_elem);
	$dom([new_elem, $("box2"), $("box3")], function (item)
	{
		$css.set(item, 'background-color', '#cccccc');
		$text(item, "This is the matched DOM object");
		$animate(item, {
			"padding": "25px",
			"width": "200px"
		});
	});
}
Demonstration
This is the box with box className
This is the box with id 'box1'
This is the box with id 'box2'
This is the box with id 'box3'