mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-17 22:40:31 +00:00
58 lines
No EOL
1.9 KiB
HTML
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"><!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<script src="http://code.jquery.com/jquery-latest.js"></script>
|
|
</head>
|
|
<body>
|
|
<button>Show Trim Example</button>
|
|
<script>
|
|
|
|
$("button").click(function () {
|
|
var str = " lots of spaces before and after ";
|
|
alert("'" + str + "'");
|
|
|
|
str = jQuery.trim(str);
|
|
alert("'" + str + "' - no longer");
|
|
});
|
|
|
|
</script>
|
|
</body>
|
|
</html></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> |