Skip to content

adf0001/element-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

element-tool

dom element tool, extend module ele-tool.

Install

npm install element-tool

Usage & Api

var element_tool = require("element-tool");

//.ele(idOrEl)		//refer module ele-tool
element_tool('divResult') === document.getElementById('divResult') &&
element_tool(document.getElementById('divResult')) === document.getElementById('divResult');

//.fromId(id)		//same as document.getElementById()
element_tool.fromId('divResult') === document.getElementById('divResult');

//.id(el, prefix)		//create and set element a new unique id, or return the existed id.
element_tool('divResult2').innerHTML = '<span>child</span>';
console.log('new id= ' + element_tool.id(element_tool('divResult2').firstChild) + ', new id2= ' + element_tool.id());
element_tool.id(document.getElementById('divResult2')) === 'divResult2';

About

dom element tool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published