Skip to content

0.9.1

Latest
Compare
Choose a tag to compare
@dealfonso dealfonso released this 22 Oct 18:45

This library converts a DOM tree to an arbitrary object so that its named (or id) properties can be accessed using dot notation.

Example

<div id="mydata">
    <input type="text" name="username" value="johndoe" />
    <input type="password" name="password" value="secret" />
    <button id="mybutton">Click me!</button>
</div>
var data = DOM2Object("#mydata");
data.mybutton.onclick = function() {
    console.log(`Button clicked! ${data.username.value}:${data.password.value}`);
};