⬇️ Download
Include the library in your page
<script src="path/to/kew.min.js"></script>
$kew().ready(function(){
// code to be executed after document has loaded
});
You can select an element by using a CSS type selection.
$kew('div');
$kew('.foo div');
$kew('#foo.bar');
// Loops through all selected elements and executes function
$kew('#foo').each(function(el) {
console.log(el.innerHTML);
})
// Adds an attribute to all selected elements
$kew('#foo').attr('data-custom', 'myValue');
// result: <div id="foo" data-custom="myValue"></div>
// An alias of attr() - adds a class to an element
$kew('#foo').class('bar');
// result: <div id="foo" class="bar"></div>
// Removes selected elements from the document
$kew('#foo').remove();
// Add a child element to a specified parent element
$kew('#foo').add('<p>bar</p>');