Started

Selectors

Utilities

Animation

AJAX

CSS

Event

Manipulation

Cookie

String

Attributes

Data

Storage

Miscellaneous

$id

Select element by id or a group of elements by ids for complex and continuous manipulation
$id( id, callback )
  1. id [string/array]
    The element id or an array or string with a group of element ids.
  2. callback (optional) [function]
    The callback function for each matched elements.

Notes

This is the function to select a element or a group of elements by id for effectively multi-processing them with callback function.

Example

HTML code
<div class="box" id="box1">Hello world!</div>
<div class="box" id="box2">Hello world!</div>
<div class="box" id="box3">Hello world!</div>
<div class="box" id="box4">Hello world!</div>
<div class="box" id="box5">Hello world!</div>
<button onclick="select_element()">select element</button>
CSS code
.box {
	width: 200px;
	height: 60px;
	font-size: 12px;
	background: #5599bb;
	padding: 10px;
	margin: 5px 0;
}
JavaScript code
function select_element()
{
	// Using the string with ids split with blankspace
	$id("box1 box3 box5", function (item)
	{
		$text(item, "I found this box");
		$css.set(item, {
			"background": "#333",
			"color": "#fff",
			"width": "350px"
		});
		$append(item, '<a href="http://qatrix.com">http://qatrix.com</a>');
	});

	// Or by array
	// $id(["box1","box3","box5"], callback)
}
Demonstration
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!