jquery-mobile/experiments/api-viewer/docs/text-selector/index.html
scottjehl c7fae44a5c added a jQuery api viewer demo.
NOTE: content is a modified version of the downloadable HTML from http://jqapi.com
2010-09-16 13:13:38 -04:00

67 lines
No EOL
2.5 KiB
HTML

<!DOCTYPE html>
<html lang='en'><head><meta http-equiv='content-type' content='text/html; charset=UTF-8' /></head><body>
<div class="ui-page">
<div class="ui-header">
<h1>:text Selector</h1>
</div>
<div class="entry selector" id="text1">
<h2 class="jq-clearfix roundTop section-title">
<span class="name">text</span> selector</h2>
<div class=" entry-details">
<h4 class="name">
<span class="versionAdded">version added: <a href="/version/1.0/">1.0</a></span>jQuery(':text')</h4>
<p class="desc"><strong>Description: </strong>Selects all elements of type text.</p>
<div class="longdesc"><p><code>$(':text')</code> is equivalent to <code>$('[type=text]')</code> and thus selects all <code>&lt;input type="text"&gt;</code> elements. As with other pseudo-class selectors (those that begin with a ":") it is recommended to precede it with a tag name or some other selector; otherwise, the universal selector ("*") is implied. In other words, the bare <code>$(':text')</code> is equivalent to <code>$('*:text')</code>, so <code>$('input:text')</code> should be used instead. </p></div>
<h3>Example:</h3>
<div id="entry-examples" class="entry-examples"><div id="example-0">
<h4><span class="desc">Finds all text inputs.</span></h4>
<pre><code class="example demo-code">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;style&gt;
textarea { height:25px; }
&lt;/style&gt;
&lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form&gt;
&lt;input type="button" value="Input Button"/&gt;
&lt;input type="checkbox" /&gt;
&lt;input type="file" /&gt;
&lt;input type="hidden" /&gt;
&lt;input type="image" /&gt;
&lt;input type="password" /&gt;
&lt;input type="radio" /&gt;
&lt;input type="reset" /&gt;
&lt;input type="submit" /&gt;
&lt;input type="text" /&gt;
&lt;select&gt;&lt;option&gt;Option&lt;/option&gt;&lt;/select&gt;
&lt;textarea&gt;&lt;/textarea&gt;
&lt;button&gt;Button&lt;/button&gt;
&lt;/form&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;script&gt;
var input = $("form input:text").css({background:"yellow", border:"3px red solid"});
$("div").text("For this type jQuery found " + input.length + ".")
.css("color", "red");
$("form").submit(function () { return false; }); // so it won't submit
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
<h4>Demo:</h4>
<div class="demo code-demo"></div>
</div></div>
</div>
</div>
</div>
</body></html>