$(selector, [context])

Simple DOM selector function

Parameters

  • string selector :

    The dom selector string

  • [Object] context :

    context of the dom selector string

Returns

Object :

The DOM element(s) that were selected

$_(selector, [context])

$_

Constructor function

Parameters

  • string selector :

    The dom selector string

  • [Object] context :

    Context of the dom selector string

Returns

Object :

KIS object

Static members

.ext(name, obj)

Adds the property obj to the $_ object, calling it name

ext(name, obj)

Adds the property obj to the $_ object, calling it name

Parameters

  • string name :

    name of the module

  • object obj :

    the object to add

Returns

void

Examples

$_.ext('foo', {});

_toCamel(s)

Change css property name to it's javascript camel case equivalent

Parameters

  • String s :

    the string to convert to camelCase

Returns

String :

the newly camelCased string

add(event, callback)

Adds an event that returns a callback when triggered on the selected event and selector

Parameters

Examples

$_("#selector").event.add("click", do_something());

create(name, [data])

Create a custom event

Parameters

Returns

Object

Examples

var event = $_("#selector").event.create('foo', {});

delegate(target, event, callback)

Binds an event to a parent object

Parameters

Examples

$_("#parent").delegate(".button", "click", do_something());

live(target, event, callback)

Binds a persistent event to the document

Parameters

Examples

$_.event.live(".button", "click", do_something());

remove(event, callback)

Removes an event bound the the specified selector, event type, and callback

Parameters

Examples

$_("#selector").event.remove("click", do_something());

trigger(event)

Trigger an event to fire

Parameters

Returns

boolean

Examples

$_("#my_id").trigger('click');

dom(className)

DOM

Dom manipulation module

Parameters

  • className :

Static members

.addClass(className)

Adds a class to the element(s) specified by the current selector

addClass(className)

Adds a class to the element(s) specified by the current selector

Parameters

  • string className :

    css class name to add to the selected element(s)

Returns

void
.append(htm)

Adds to the innerHTML of the current element, after the last child.

append(htm)

Adds to the innerHTML of the current element, after the last child.

Parameters

Examples

$_("ul").dom.append("<li></li>"); // Adds an li element to the end of the selected ul element
.attr(name, [value])

Sets attributes on element(s) specified by the current selector, or, if name is not specified, returns the value of the attribute of the element specified by the current selector.

attr(name, [value])

Sets attributes on element(s) specified by the current selector, or, if name is not specified, returns the value of the attribute of the element specified by the current selector.

Parameters

  • string name :
  • [undefined] value :

Returns

.css(property, [value], prop, val)

Sets or retrieves a css property of the element specified by the current selector. If a value is passed, it will set that value on the current element, otherwise it will return the value of the css property on the current element.

Accepts either key/value arguments, or an object with multiple key/value pairs.

css(property, [value], prop, val)

Sets or retrieves a css property of the element specified by the current selector. If a value is passed, it will set that value on the current element, otherwise it will return the value of the css property on the current element.

Accepts either key/value arguments, or an object with multiple key/value pairs.

Parameters

  • string or Object property :
  • [undefined] value :
  • prop :
  • val :

Returns

Examples

$_('#foo').dom.css('border', 0);
$_('#foo').dom.css({background:'#000', color:'#fff'});
.hide

Hides the element(s) specified by the current selector

hide

Hides the element(s) specified by the current selector

Returns

void
.html([htm])

Sets or gets the innerHTML propery of the element(s) passed

html([htm])

Sets or gets the innerHTML propery of the element(s) passed

Parameters

  • [undefined] htm :

Returns

.prepend(htm)

Adds to the innerHTML of the selected element, before the current children

prepend(htm)

Adds to the innerHTML of the selected element, before the current children

Parameters

Examples

$_("ul").dom.append("<li></li>"); // Adds an li element to the beginning of the selected ul element
.removeClass(className)

Removes a class from the element(s) specified by the current selector

removeClass(className)

Removes a class from the element(s) specified by the current selector

Parameters

  • string className :

    css class name to remove from the selected element(s)

Returns

void
.show([type])

Shows the element(s) specified by the current selector. if type is specified, the element will have it's style property set to "display:[your type]". If type is not specified, the element is set to "display:block".

show([type])

Shows the element(s) specified by the current selector. if type is specified, the element will have it's style property set to "display:[your type]". If type is not specified, the element is set to "display:block".

Parameters

Returns

void
.text([value])

Sets or retrieves the text content of the element specified by the current selector. If a value is passed, it will set that value on the current element, otherwise it will return the value of the current element

text([value])

Sets or retrieves the text content of the element specified by the current selector. If a value is passed, it will set that value on the current element, otherwise it will return the value of the current element

Parameters

  • [undefined] value :

Returns

store(key, sess)

Wrapper for localstorage / sessionstorage data serialization. Each method has a boolean parameter, that when set as true switches the method to use sessionStorage rather than the default localStorage.

Parameters

  • key :
  • sess :

Static members

.clear(session, sess)

Removes all values from the same domain storage

clear(session, sess)

Removes all values from the same domain storage

Parameters

  • bool session :
  • sess :
.get(key, session, sess)

Retrieves and deserializes a value from localstorage, based on the specified key

get(key, session, sess)

Retrieves and deserializes a value from localstorage, based on the specified key

Parameters

  • string key :
  • bool session :
  • sess :

Returns

Object
.getAll(session, sess)

Returns an object of all the raw values in storage

getAll(session, sess)

Returns an object of all the raw values in storage

Parameters

  • bool session :
  • sess :

Returns

Object
.remove(key, session, sess)

Removes the specified item from storage

remove(key, session, sess)

Removes the specified item from storage

Parameters

  • string key :
  • bool session :
  • sess :
.set(key, value, session, sess)

Puts a value into localstorage at the specified key, and JSON-encodes the value if not a string

set(key, value, session, sess)

Puts a value into localstorage at the specified key, and JSON-encodes the value if not a string

Parameters

  • string key :
  • mixed value :
  • bool session :
  • sess :

el

Current selector object

event(name, data)

Event Listener module

Parameters

  • name :
  • data :

ext(url, [options], [data])

Send an ajax request

Parameters

  • string url :

    The url to retrieve

  • [Object] options :

    Request type parameters

  • [Object] data :

    Request data

Returns

Promise

ext(url, data, success_callback, [error_callback])

Sends a GET type ajax request

Parameters

  • string url :

    The url to retrieve

  • Object data :

    get parameters to send

  • function success_callback :

    callback called on success

  • [function] error_callback :

    callback called if there is an error

ext(url, data, success_callback, [error_callback])

Sends a POST type ajax request

Parameters

  • string url :

    The url to post to

  • Object data :

    post parameters to send

  • function success_callback :

    callback called on success

  • [function] error_callback :

    callback called if there is an error

ext(url, data, success_callback, [error_callback])

Sends a PUT type ajax request

Parameters

  • string url :

    The url to post to

  • Object data :

    PUT parameters to send

  • function success_callback :

    callback called on success

  • [function] error_callback :

    callback called if there is an error

ext(callback)

Iterates over a $_ object, applying a callback to each item

Parameters

  • function callback :

    iteration callback

Returns

void

Examples

$_('form input').each(function(item) { alert(item) });

ext(url, data, success_callback, [error_callback])

Sends a DELETE type ajax request

Parameters

  • string url :

    The url to post to

  • Object data :

    delete parameters to send

  • function success_callback :

    callback called on success

  • [function] error_callback :

    callback called if there is an error

type(obj)

Retrieves the type of the passed variable

Parameters

  • Any obj :

    Object to test

Returns

string :

variable type

Examples

$_.type([]); // Returns 'array'

undefined

DOM

Dom manipulation module

undefined

Event

Event api wrapper

undefined

Kis JS Keep It Simple JS Library Copyright Timothy J. Warren License Public Domain Version 0.10.1

undefined

Ajax

Module for making ajax requests

undefined

Store

Wrapper for local / sessionstorage