Skip to content

aakilfernandes/jquery.inject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 

Repository files navigation

jquery.inject is a plugin for avoiding ugly, unreadable HTML DOM object injections

The old way:

$('body').append('<div id="header" class="wrapped"></div>');`

The new way:

var body = $('body');
body.inject('div#header.wrapped');

You can even pass in an array

var body = $('body');
body.inject(['div#header.wrapped','div#main.wrapped']);

Injections automatically create a tree that can be easily traverse. Object names are dynamically created from the first given attribute ('id' or 'class').

var body = $('body');
body.inject(['div#header.wrapped','div#main.wrapped']);
//Automatically creates body.header and body.main
body.header.inject('span.title');
body.main.inject('div.left');
body.main.inject('div.right');

About

A jQuery plugin that allows you to easily inject HTML DOM without bulky selectors and annoying append()s.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published