jQwerty is a DOM manipulation library inspired by jQuery. This library can be used for making AJAX requests, handling events, and manipulating the DOM.
jQwerty is an easy to use library that can be downloaded into your project and included as a script tag in the head of your html document.
<script src="./lib/jQwerty.js" type="text/javascript"></script>
The jQwerty library exports a global variable, $j
that accepts three classes of objects: strings used as CSS selectors, instances of HTML Elements, as well as functions. $j
acts as a wrapper, returning an instance of DOMNodeCollection for all of the methods in the jQwerty library.
The each method acts as an itterator on DomNodeCollection objects, applying a callback function to each respective element in the array.
Returns an instance of DOMNodeCollection with the direct children of a given HTML Element.
Returns an instance of DOMNodeCollection with the direct parent of a given HTML Element input.
Returns the inner html of a given input element. If this method is called on a collection of elements, it will only return the inner html of the first element in the collection.
Sets the inner html of a given input element equal to an empty string. This method works on single elements as well as collections.
Appends content(either html or string) to the end of each element in the set of matched elements.
Takes one or an optional second argument attr(k,v)
. Depending on the input value this method can be used to retrieve the value of k
within the given element, or set the value of k
equal to v
.
Accepts a string argument and sets the html elements className equal to the input string.
Removes a given class from an element.
Searches the descendants of a given html element using an argument as a selector. Constructs a new DOMNodeCollection object from the resulting matches.
Removes the set of all elements matching the selector argument.
Takes an event and callback as arguments and places the event listener on the DOM element. When the event is triggered the callback will be executed.
Removes events from elements in the DOM.