Skip to content

Commit bcb87bf

Browse files
gibson042kswedberg
authored andcommitted
.val(): Be more clear about when null is returned
Ref jQuery #14654 Closes jquery#406
1 parent b83bd13 commit bcb87bf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

entries/val.xml

+1-1
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>&lt;select multiple="multiple"&gt;</code> elements, the <code>.val()</code> method returns an array containing each selected option; if no option is selected, it returns <code>null</code>. </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>. 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>
1515
<p>For selects and checkboxes, you can also use the <a href="/selected/">:selected</a> and <a href="/checked/">: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)