DOM

Set of methods for manipulating the Document Object Model (DOM).

html

Manipulates HTML in the DOM. Also just returns the inner HTML of elements in the collection if called with no arguments.

syntax

x$( window ).html( location, html );

or this method will accept just a HTML fragment with a default behavior of inner:

x$( window ).html( html );

or you can use shorthand syntax by using the location name argument as the function name:

x$( window ).outer( html );
x$( window ).before( html );

or you can just retrieve the inner HTML of elements in the collection with:

x$( document.body ).html();

arguments

example

x$('#foo').html('inner', '<strong>rock and roll</strong>');
x$('#foo').html('outer', '<p>lock and load</p>');
x$('#foo').html('top',   '<div>bangers and mash</div>');
x$('#foo').html('bottom','<em>mean and clean</em>');
x$('#foo').html('remove');
x$('#foo').html('before', '<p>some warmup html</p>');
x$('#foo').html('after',  '<p>more html!</p>');

or

x$('#foo').html('<p>sweet as honey</p>');
x$('#foo').outer('<p>free as a bird</p>');
x$('#foo').top('<b>top of the pops</b>');
x$('#foo').bottom('<span>bottom of the barrel</span>');
x$('#foo').before('<pre>first in line</pre>');
x$('#foo').after('<marquee>better late than never</marquee>');

attr

Gets or sets attributes on elements. If getting, returns an array of attributes matching the xui element collection's indices.

syntax

x$( window ).attr( attribute, value );

arguments

example

To get an attribute value, simply don't provide the optional second parameter:

x$('.someClass').attr('class');

To set an attribute, use both parameters:

x$('.someClass').attr('disabled', 'disabled');