XUI Examples

A collection of the simplest possible examples of how to use XUI to build mobile web apps.

Selector system

An XUI object is instantiated with the x$ method accepting any element, css selector or array of selectors as an argument.

// any element
x$(window)

// a css selector 
x$('ul#nav li a.selected');

// an array of selectors
x$(['li', 'div#foo']);

First convenience method

Rather often you want to do something with just the first element in the collection.

// returns the first element
x$('li').first();

Each iterator

Used internally by nearly every method in XUI to loop through the element collection.

	
// each iterator
x$('button').each(function(element){
	
});