Skip to content

Commit f54a9a5

Browse files
committed
Remove duplicate info due to my bad merge
2 parents ef2a80e + 470df7b commit f54a9a5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

entries/val.xml

+7-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
<longdesc>
1414
<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 called on an empty collection, it returns <code>undefined</code>.</p>
1515
<p>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), <code>.val()</code> returns an array containing the value of each selected option. <strong>As of jQuery 3.0</strong>, if no options are selected, it returns an empty array; <strong>prior to jQuery 3.0</strong>, it returns <code>null</code>.</p>
16-
<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>
17-
<p><strong>jQuery 3</strong> changes the behavior of this method to return an empty array if a collection is a <code>select-multiple</code> and no options are selected.</p>
16+
<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>
1817
<pre><code>
18+
1919
// Get the value from a dropdown select
2020
$( "select.foo option:selected").val();
2121

@@ -29,7 +29,7 @@ $( "input:checkbox:checked" ).val();
2929
$( "input:radio[name=bar]:checked" ).val();
3030
</code></pre>
3131
<div class="warning">
32-
<p><strong>Note: </strong> At present, using <code>.val()</code> on textarea elements strips carriage return characters from the browser-reported value. When this value is sent to the server via XHR, however, carriage returns are preserved (or added by browsers which do not include them in the raw value). A workaround for this issue can be achieved using a valHook as follows:</p>
32+
<p><strong>Note: </strong> At present, using <code>.val()</code> on <code>&lt;textarea&gt;</code> elements strips carriage return characters from the browser-reported value. When this value is sent to the server via XHR, however, carriage returns are preserved (or added by browsers which do not include them in the raw value). A workaround for this issue can be achieved using a valHook as follows:</p>
3333
</div>
3434
<pre><code>
3535
$.valHooks.textarea = {
@@ -46,7 +46,11 @@ function displayVals() {
4646
var singleValues = $( "#single" ).val();
4747
var multipleValues = $( "#multiple" ).val() || [];
4848
// When using jQuery 3:
49+
<<<<<<< HEAD
4950
// var multipleValues = $( "#multiple" ).val()
51+
=======
52+
// var multipleValues = $( "#multiple" ).val();
53+
>>>>>>> multi-select-val
5054
$( "p" ).html( "<b>Single:</b> " + singleValues +
5155
" <b>Multiple:</b> " + multipleValues.join( ", " ) );
5256
}

0 commit comments

Comments
 (0)