- Small, fast, and modular DOM & Event library for modern browsers.
- Same familiar API as jQuery (but without the extra weight of modules like
$.ajax, $ .animate etc.). - The source is written in ES6.
- Experimental single event manager.
Get the value of a style property for the first element, or set one or more style properties for each element in the collection.
$('.blitz').css('margin'); // get
$('.blitz').css('backgroundColor', '#333'); // set
$('.blitz').css({ 'color': '#fff', 'backgroundColor': '#333' }); // set multiple
append
Append element(s) to each element in the collection.
$('.blitz').append(ele);
$('.blitz').append('<p>blitz.js</p>');
$('.blitz').append([ele, '<p>blitz.js</p>']);
prepend
Place element(s) at the beginning of each element in the collection.
$('.blitz').prepend(ele);
$('.blitz').prepend('<p>blitz.js</p>');
$('.blitz').prepend([ele, '<p>blitz.js</p>']);
before
Place element(s) before each element in the collection.
$('.blitz').before(ele);
$('.blitz').before('<p>blitz.js</p>');
$('.blitz').before([ele, '<p>blitz.js</p>']);
after
Place element(s) after each element in the collection.
$('.blitz').after(ele);
$('.blitz').after('<p>blitz.js</p>');
$('.blitz').after([ele, '<p>blitz.js</p>']);
remove
Remove the collection from the DOM.
$('.blitz').remove();
children
Return children of the first element in the collection.
$('.blitz').children();
childNodes
Return child nodes of the first element in the collection.
$('.blitz').childNodes();
contains
Check if an element contains a given element in the DOM.
$('.blitz').contains(ele);
eq
Return element at the given index from the collection.
$('.blitz').eq(0);
html
Get the HTML contents of the first element, or set the HTML contents for each element in the collection.
$('.blitz').html(); // get
$('.blitz').html('<p>blitz.js</p>'); // set
attr
Get the value of an attribute for the first element, or set an attribute for each element in the collection.
$('.blitz').attr('attrName'); // get
$('.blitz').attr('attrName', 'attrValue'); // set
addClass
Add the given class(es) to each element in the collection.
$('.blitz').addClass('foo', 'bar');
removeClass
Remove the given class(es) from each element in the collection.
$('.blitz').removeClass('foo', 'bar');
toggleClass
Toggle the given class(es) of the first element in the collection.
$('.blitz').toggleClass('foo');
hasClass
Check if the first element in the collection has the given class.
$('.blitz').hasClass('foo');
on
Shorthand for addEventListener. Currently doesn't support event delegation.
$('.blitz').on('eventName', callback);
off
Shorthand for removeEventListener.
$('.blitz').off('eventName');
$('.blitz').off('eventName', callback);
$('.blitz').off();
val
Get the value from the first, or set the value of each element in the collection.
$('.blitz.input').val(); // get
$('.blitz.input').val('some value'); // set
extend
Extend the properties of an object from the given sources, or extend blitz when no source is given.
$.extend(targetObject, [, sourceObjects]);
$.extend(plugin);
$.extend([, plugins]);
- event delegation.
- event trigger.
- listen to events once, twice, thrice and nth.