You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: entries/text-selector.xml
+40-33
Original file line number
Diff line number
Diff line change
@@ -7,48 +7,55 @@
7
7
</signature>
8
8
<desc>Selects all elements of type text.</desc>
9
9
<longdesc>
10
-
<p><code>$(':text')</code> allows us to select all <code><input type="text"></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>
10
+
<p><code>$( ":text" )</code> allows us to select all <code><input type="text"></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>
11
11
<p><strong>Note:</strong> As of jQuery 1.5.2, <code>:text</code> selects <code>input</code> elements that have no specified <code>type</code> attribute (in which case <code>type="text"</code> is implied). </p>
12
-
<p>This difference in behavior between <code>$(':text')</code> and <code>$('[type=text]')</code>, can be seen below:</p>
Copy file name to clipboardExpand all lines: entries/text.xml
+54-32
Original file line number
Diff line number
Diff line change
@@ -9,33 +9,41 @@
9
9
<desc>Get the combined text contents of each element in the set of matched elements, including their descendants.</desc>
10
10
<longdesc>
11
11
<p>Unlike the <code>.html()</code> method, <code>.text()</code> can be used in both XML and HTML documents. The result of the <code>.text()</code> method is a string containing the combined text of all matched elements. (Due to variations in the HTML parsers in different browsers, the text returned may vary in newlines and other white space.) Consider the following HTML:</p>
<p>The code <code>$('div.demo-container').text()</code> would produce the following result:</p>
19
+
</div>
20
+
</code></pre>
21
+
<p>The code <code>$( "div.demo-container" ).text()</code> would produce the following result:</p>
21
22
<p>
22
23
<code>Demonstration Box list item 1 list item 2</code>
23
24
</p>
24
-
<p>The <code>.text()</code> method cannot be used on form inputs or scripts. To set or get the text value of <code>input</code> or <code>textarea</code> elements, use the <ahref="/val"><code>.val()</code></a> method. To get the value of a script element, use the <ahref="/html"><code>.html()</code></a> method.</p>
25
+
<p>The <code>.text()</code> method cannot be used on form inputs or scripts. To set or get the text value of <code>input</code> or <code>textarea</code> elements, use the <ahref="/val/"><code>.val()</code></a> method. To get the value of a script element, use the <ahref="/html/"><code>.html()</code></a> method.</p>
25
26
<p>As of jQuery 1.4, the <code>.text()</code> method returns the value of text and CDATA nodes as well as element nodes.</p>
26
27
</longdesc>
27
28
<example>
28
29
<desc>Find the text in the first paragraph (stripping out the html), then set the html of the last paragraph to show it is just text (the red bold is gone).</desc>
<p>Unlike the <code>.html()</code> method, <code>.text()</code> can be used in both XML and HTML documents. </p>
60
68
<p>We need to be aware that this method escapes the string provided as necessary so that it will render correctly in HTML. To do so, it calls the DOM method <code>.createTextNode()</code>, does not interpret the string as HTML. Consider the following HTML:</p>
Copy file name to clipboardExpand all lines: entries/toggle-event.xml
+19-14
Original file line number
Diff line number
Diff line change
@@ -16,19 +16,23 @@
16
16
</signature>
17
17
<longdesc>
18
18
<divclass="warning">
19
-
<p>Note: This method signature was deprecated in jQuery 1.8 and removed in jQuery 1.9. jQuery also provides an animation method named <ahref="http://api.jquery.com/toggle/">.toggle()</a> that toggles the visibility of elements. Whether the animation or the event method is fired depends on the set of arguments passed.</p>
19
+
<p>Note: This method signature was deprecated in jQuery 1.8 and removed in jQuery 1.9. jQuery also provides an animation method named <ahref="/toggle/">.toggle()</a> that toggles the visibility of elements. Whether the animation or the event method is fired depends on the set of arguments passed.</p>
20
20
</div>
21
21
<p>The <code>.toggle()</code> method binds a handler for the <code>click</code> event, so the rules outlined for the triggering of <code>click</code> apply here as well.</p>
22
-
<pre><code>For example, consider the HTML:
22
+
<p>For example, consider the HTML:</p>
23
+
<pre><code>
23
24
<div id="target">
24
25
Click here
25
-
</div></code></pre>
26
+
</div>
27
+
</code></pre>
26
28
<p>Event handlers can then be bound to the <code><div></code>:</p>
27
-
<pre><code>$('#target').toggle(function() {
28
-
alert('First handler for .toggle() called.');
29
+
<pre><code>
30
+
$( "#target" ).toggle(function() {
31
+
alert( "First handler for .toggle() called." );
29
32
}, function() {
30
-
alert('Second handler for .toggle() called.');
31
-
});</code></pre>
33
+
alert( "Second handler for .toggle() called." );
34
+
});
35
+
</code></pre>
32
36
<p>As the element is clicked repeatedly, the messages alternate:</p>
33
37
<p>
34
38
<samp>First handler for .toggle() called.</samp>
@@ -46,14 +50,15 @@
46
50
</longdesc>
47
51
<example>
48
52
<desc>Toggle a style on table cells. (Not recommended. Use .toggleClass() instead.):</desc>
0 commit comments