jquery-mobile/experiments/api-viewer/docs/jQuery.trim/index.html
2010-11-01 21:46:29 -04:00

58 lines
No EOL
1.9 KiB
HTML

<!DOCTYPE html>
<html lang='en'><head>
<meta charset="utf-8" /><meta http-equiv='content-type' content='text/html; charset=UTF-8' /></head><body>
<div data-role="page">
<div data-role="header">
<h1>jQuery.trim()</h1>
</div>
<div data-role="content" data-theme="c" id="jQuery.trim1">
<h2 class="jq-clearfix roundTop section-title">
<span class="name">jQuery.trim()</span> <span class="returns">Returns: <a class="return" href="http://docs.jquery.com/Types#String">String</a></span>
</h2>
<div class=" entry-details">
<p class="desc"><strong>Description: </strong>Remove the whitespace from the beginning and end of a string.</p>
<ul class="signatures"><li class="signature" id="jQuery.trim"><h4 class="name">
<span class="versionAdded">version added: <a href="/category/version/1.0/">1.0</a></span>jQuery.trim()</h4></li></ul>
<h3>Examples:</h3>
<div id="entry-examples" class="entry-examples">
<div id="example-0">
<h4>Example: <span class="desc">Removes the two whitespaces at the start and at the end of the string.</span>
</h4>
<pre><code class="example demo-code">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;button&gt;Show Trim Example&lt;/button&gt;
&lt;script&gt;
$("button").click(function () {
var str = " lots of spaces before and after ";
alert("'" + str + "'");
str = jQuery.trim(str);
alert("'" + str + "' - no longer");
});
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
<h4>Demo:</h4>
<div class="demo code-demo"></div>
</div>
<div id="example-1">
<h4>Example: <span class="desc">Removes the two whitespaces at the start and at the end of the string.</span>
</h4>
<pre><code class="example">$.trim(" hello, how are you? ");</code></pre>
<h4>Result:</h4>
<pre><code class="results">"hello, how are you?"</code></pre>
</div>
</div>
</div>
</div>
</div>
</body></html>