jquery-like dom manipulation. Tiny (2.1kB minified & gzipped)
$ component install matthewmueller/helix
$ make clean && make
$ xdg-open test/test.html
Require Helix.
var $ = require('helix');
Select an element.
$('.name')
$('#nav')
Get and set text
$('.name').text('Matt')
$('.name').text() // ["Matt"]
Get and set HTML
$('.name').html('<strong>Matt</strong>')
$('.name').html() // ["<strong>Matt</strong>"]
Get the descendants of each element in the current set of matched elements, filtered by a selector.
$('.person').find('span')
Get the direct descendants of each element in the current set of matched elements, filtered by a selector.
$('.person').children('span')
Get a single element from the set of matched elements.
$('span').eq(1).html()
Add a class
$('.name').addClass('person')
Remove a class
$('.name').removeClass('person')
Toggle a class
$('.name').toggleClass('person')
Get and set attributes that are on the selected element.
<input class="user" id="user" type="text" name="user">
$('.user').attr('type', 'radio').attr('name', 'person')
$('.user').attr('type') // ["radio"]
Get and set attribute that doesn't already exist
$('.user').attr('data-author', 'matt')
Hide all matched elements.
$('span').hide()
Show all matched elements.
$('span').show()
Toggle display of all matched elements.
$('span').toggle()
MIT