Skip to content

Commit 37fe857

Browse files
committed
val: Updated description for the setter version
Fixes jquery#712 Closes jquerygh-744
1 parent a4e5e98 commit 37fe857

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
@@ -123,7 +123,7 @@ $( "input" )
123123
<desc>Set the value of each element in the set of matched elements.</desc>
124124
<longdesc>
125125
<p>This method is typically used to set the values of form fields. </p>
126-
<p>Passing an array of element values allows matching <code>&lt;input type="checkbox"&gt;</code>, <code>&lt;input type="radio"&gt;</code> and <code>&lt;option&gt;</code>s inside of n <code>&lt;select multiple="multiple"&gt;</code> to be selected. In the case of <code>&lt;input type="radio"&gt;</code>s that are part of a radio group and <code>&lt;select multiple="multiple"&gt;</code> the other elements will be deselected.</p>
126+
<p><code>val()</code> allows you to pass an array of element values. This is useful when working on a jQuery object containing elements like <code>&lt;input type="checkbox"&gt;</code>, <code>&lt;input type="radio"&gt;</code>, and <code>&lt;option&gt;</code>s inside of a <code>&lt;select&gt;</code>. In this case, the <code>input</code>s and the <code>option</code>s having a <code>value</code> that matches one of the elements of the array will be checked or selected while those having a <code>value</code> that don't match one of the elements of the array will be unchecked or unselected, depending on the type. In case of <code>&lt;input type="radio"&gt;</code>s that are part of a radio group and <code>&lt;select&gt;</code>s, any previously selected element will be deselected.</p>
127127
<p>The <code>.val()</code> method allows us to set the value by passing in a function. As of jQuery 1.4, the function is passed two arguments, the current element's index and its current value: </p>
128128
<pre><code>
129129
$( "input:text.items" ).val(function( index, value ) {

0 commit comments

Comments
 (0)