Skip to content

Commit 0756614

Browse files
gibson042AurelioDeRosa
authored andcommitted
val: Document empty-context behavior
Fixes jquerygh-893 Ref jquery/jquery#2319 Closes jquerygh-897
1 parent 6cbf6b7 commit 0756614

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

entries/val.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</signature>
1212
<desc>Get the current value of the first element in the set of matched elements.</desc>
1313
<longdesc>
14-
<p>The <code>.val()</code> method is primarily used to get the values of form elements such as <code>input</code>, <code>select</code> and <code>textarea</code>. In the case of <code>select</code> elements, it returns <code>null</code> when no option is selected and an array containing the value of each selected option when there is at least one and it is possible to select more because the <code>multiple</code> attribute is present.</p>
14+
<p>The <code>.val()</code> method is primarily used to get the values of form elements such as <code>input</code>, <code>select</code> and <code>textarea</code>. When the first element in the collection is a <code>select-multiple</code> (i.e., a <code>select</code> element with the <code>multiple</code> attribute set), it returns an array containing the value of each selected option, or <code>null</code> if no options are selected. When called on an empty collection, it returns <code>undefined</code>.</p>
1515
<p>For selects and checkboxes, you can also use the <a href="/selected-selector/">:selected</a> and <a href="/checked-selector/">:checked</a> selectors to get at values, for example:</p>
1616
<pre><code>
1717
// Get the value from a dropdown select

0 commit comments

Comments
 (0)