This repository has been archived by the owner on Nov 21, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
38 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,81 @@ | ||
|
||
<h1><a name="DOM">DOM</a></h1> | ||
|
||
<p>Set of methods used for manipulating the Document Object Model (<a href="dom#DOM">DOM</a>).</p> | ||
<p>Set of methods for manipulating the Document Object Model (<a href="dom#DOM">DOM</a>).</p> | ||
|
||
<h2>html</h2> | ||
|
||
<p>For manipulating HTML in the <a href="dom#DOM">DOM</a>.</p> | ||
<p>Manipulates HTML in the <a href="dom#DOM">DOM</a>.</p> | ||
|
||
<h3>syntax</h3> | ||
|
||
<pre><code>x$(window).html( location, html ); | ||
<pre><code>x$( window ).html( location, html ); | ||
</code></pre> | ||
|
||
<p>or this method will accept just an html fragment with a default behavior of inner.</p> | ||
<p>or this method will accept just a HTML fragment with a default behavior of inner:</p> | ||
|
||
<pre><code>x$(window).html( html ); | ||
<pre><code>x$( window ).html( html ); | ||
</code></pre> | ||
|
||
<p>or you can use shorthand syntax by using the location name argument (see below) as the function name.</p> | ||
<p>or you can use shorthand syntax by using the location name argument as the function name:</p> | ||
|
||
<pre><code>x$(window).outer( html ); | ||
x$(window).before( html ); | ||
<pre><code>x$( window ).outer( html ); | ||
x$( window ).before( html ); | ||
</code></pre> | ||
|
||
<h3>arguments</h3> | ||
|
||
<ul> | ||
<li>location:string can be one of: inner, outer, top, bottom, remove, before or after.</li> | ||
<li>html:string any string of html markup or an HTMLElement.</li> | ||
<li>location <code>String</code> can be one of: <em>inner</em>, <em>outer</em>, <em>top</em>, <em>bottom</em>, <em>remove</em>, <em>before</em> or <em>after</em>.</li> | ||
<li>html <code>String</code> is a string of HTML markup or a <code>HTMLElement</code>.</li> | ||
</ul> | ||
|
||
<h3>example</h3> | ||
|
||
<pre><code>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>'); | ||
<pre><code>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>'); | ||
</code></pre> | ||
|
||
<p>or</p> | ||
|
||
<pre><code>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>' ); | ||
<pre><code>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>'); | ||
</code></pre> | ||
|
||
<h2>attr</h2> | ||
|
||
<p>For getting or setting attributes on elements.</p> | ||
<p>Gets or sets attributes on elements.</p> | ||
|
||
<h3>syntax (and examples)</h3> | ||
<h3>syntax</h3> | ||
|
||
<pre><code>x$(window).attr( attribute, value ); | ||
<pre><code>x$( window ).attr( attribute, value ); | ||
</code></pre> | ||
|
||
<p>To retrieve an attribute value, simply don't provide the optional second parameter:</p> | ||
<h3>arguments</h3> | ||
|
||
<pre><code>x$('.someClass').attr( 'class' ); | ||
</code></pre> | ||
<ul> | ||
<li>attribute <code>String</code> is the name of HTML attribute to get or set.</li> | ||
<li>value <code>Varies</code> is the value to set the attribute to. Do not use to get the value of attribute <em>(optional)</em>.</li> | ||
</ul> | ||
|
||
<p>To set an attribute, use both parameters:</p> | ||
<h3>example</h3> | ||
|
||
<pre><code>x$('.someClass').attr( 'disabled', 'disabled' ); | ||
<p>To get an attribute value, simply don't provide the optional second parameter:</p> | ||
|
||
<pre><code>x$('.someClass').attr('class'); | ||
</code></pre> | ||
|
||
<h3>arguments</h3> | ||
<p>To set an attribute, use both parameters:</p> | ||
|
||
<ul> | ||
<li>attribute:string the name of the element's attribute to set or retrieve.</li> | ||
<li>html:string if retrieving an attribute value, don't specify this parameter. Otherwise, this is the value to set the attribute to.</li> | ||
</ul> | ||
<pre><code>x$('.someClass').attr('disabled', 'disabled'); | ||
</code></pre> | ||
|