My DOM

Meet My Dom, the simple DOM library

Download Now

Get Started

/*
* Pass an html string, element(s) and more! 
* Context is the second, optional argument.
*/

var el = dom('<h1>Hello</h1><p>Welcome</p>');

// Test, with length

console.log(el.length);

// Get with indexing

console.log(el[0].textContent);

console.log(el[1].textContent);

// Extend with fn

dom.fn.each = function (callback) {
	for (index = 0; index < this.length; index = index +1) {
		callback(this[index]);
	}
};

dom('div').each(function (el) {
	console.log(el.innerHTML);
});