Skip to content

joostdevries/boom.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

boom.js

BOOM is a little piece of JS which makes creating HTML trees from JS a little easier. It also comes with some jQuery-like syntax for which I am eternaly grateful to the great Resig.

To create a BOOM, use boom:

var myDiv = boom(['div', {cls:'my-div'}, {
    header: ['h2', {}, 'Some header in my-div'],
    form: ['form', {id: 'a-form-to-show-more-nesting'}, {
        textfield: ['input', {type:'text', name:'mytextfield', id:'mytextfield'}],
        submit ['input', {type:'submit', name:'mybutton', id:'mybutton', value:'My value'}],
    }]
}])
myDiv.appendTo(document.body)

After creating you BOOM, you can simply access all of its elements by name, for example:

myDiv.header.html('I\'ve changed the <b>header</b>');
var val = myDiv.form.textfield.val();
myDiv.form.listen('submit', function(evt) { });

About

Simple navigable DOM trees :-)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published