DOM
html
Adds elements or changes the content of an element on a page. This method has shortcut aliases:
- inner
- outer
- top
- bottom
- before
- after
- remove
Syntax
x$(window).html( location, html );
or this method will accept just an html fragment with a default behavior of inner...
x$(window).html( htmlFragment );
Arguments
- location:string can be one of 'inner', 'outer', 'top', 'bottom', 'before', 'after' or 'remove'
- html:string any string of html markup or HTMLElement
- Note: This method has some magic, if you pass a sting into the top of a list, we assume you want a list item.
Example
x$('#foo').html( 'inner', 'rock and roll' );
x$('#foo').html( 'outer', 'lock and load
' );
x$('#foo').html( 'top', 'bangers and mash');
x$('#foo').html( 'bottom', 'mean and clean');
x$('#foo').html( 'remove' 'first and last
');
Another Example
x$('#foo').html('sweet as honey
');
More Examples
x$('#foo').inner('rock and roll' );
x$('#foo').outer('lock and load
' );
x$('#foo').top('bangers and mash');
x$('#foo').bottom('mean and clean');
x$('#foo ul li').remove();