Skip to content

Commit

Permalink
Fix documentation for .val()
Browse files Browse the repository at this point in the history
  • Loading branch information
aried3r committed Jun 16, 2016
1 parent 93110b7 commit 07d5e37
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions entries/val.xml
Expand Up @@ -11,7 +11,7 @@
</signature>
<desc>Get the current value of the first element in the set of matched elements.</desc>
<longdesc>
<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>
<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 an empty array if no options are selected. When called on an empty collection, it returns <code>undefined</code>.</p>
<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>
<pre><code>
// Get the value from a dropdown select
Expand Down Expand Up @@ -42,7 +42,7 @@ $.valHooks.textarea = {
<code><![CDATA[
function displayVals() {
var singleValues = $( "#single" ).val();
var multipleValues = $( "#multiple" ).val() || [];
var multipleValues = $( "#multiple" ).val();
$( "p" ).html( "<b>Single:</b> " + singleValues +
" <b>Multiple:</b> " + multipleValues.join( ", " ) );
}
Expand Down Expand Up @@ -115,8 +115,8 @@ $( "input" )
<added>1.4</added>
<argument name="function" type="Function">
<argument name="index" type="Integer" />
<argument name="value" type="String" />
<return type="String" />
<argument name="value" type="String" />
<return type="String" />
<desc>A function returning the value to set. <code>this</code> is the current element. Receives the index position of the element in the set and the old value as arguments.</desc>
</argument>
</signature>
Expand Down

0 comments on commit 07d5e37

Please sign in to comment.