Its a super lightweight library, that simulates some basic functions of jQuery.
Supports IE10+
This library was created to demonstrate how simple it is to replace jQuery without long workarounds.
As in jQuery, its possible to select a set of DOM elements, using CSS3 compatible css selectors.
var body = $('body')
var someElements = $('ul.menu > li') // Jqsl {0: li, 1: li ... }
Loops over each item in the result set just like Array.prototype.forEach does.
$('ul.menu > li').each(function (item) {
// ... item is a DOM node
})
Similarly to the .each()
method, this loops over a set of nodes, and returns an array of modifications.
var changes = $('ul.menu > li').each(function (item) {
$(item).html('changing the content, because evil.')
})
Returns a subset of matches, similarly to Array.prototype.slice.
Returns a single element at the provided index
Appends an element to the currently selected element.
$('body').append($('<div>Hello</div>'))
Appends the currently selected element to a target element.
$('<div>So fun!</div>').appendTo('body')
Removes a set of elements.
$('.to-be-removed').remove()
Sets the html content of an element.
$('.an-element').html('this is a random <b>content</b>')
Registers an event listener to selected elements.
$('a').on('click', function () {
alert('Alerts are going to be deprecated')
})
Removes listeners for an event from selected elements.
$('a').off('click')
Triggers event for selected elements.
$('a').trigger('click')