<pclass="arguement"><strong>content</strong>An element, HTML string, or jQuery object to insert before each element in the set of matched elements.</p>
</li>
<liclass="signature"id="before-function">
<h4class="name">
<spanclass="versionAdded">version added: <ahref="/category/version/1.4/">1.4</a></span>.before( function )</h4>
<pclass="arguement"><strong>function</strong>A function that returns an HTML string to insert before each element in the set of matched elements.</p>
</li>
</ul>
<divclass="longdesc">
<p>The <code>.before()</code> and <code><ahref="/insertBefore">.insertBefore()</a></code> methods perform the same task. The major difference is in the syntax-specifically, in the placement of the content and target. With<code> .before()</code>, the selector expression preceding the method is the container before which the content is inserted. With <code>.insertBefore()</code>, on the other hand, the content precedes the method, either as a selector expression or as markup created on the fly, and it is inserted before the target container.</p>
<p>Consider the following HTML:</p>
<pre><div class="container">
<h2>Greetings</h2>
<div class="inner">Hello</div>
<div class="inner">Goodbye</div>
</div></pre>
<p>We can create content and insert it before several elements at once:</p>