Closed
Description
From jquery/jquery#2562
We have this line...
In the case of select elements, it returns null 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 multiple attribute is present.
which could say something like this instead...
When called on select elements that have no option selected, the
.val()
method returnsnull
, or an empty array if the multiple attribute is present. If at least one option is selected, either the value or an array of values will be returned.
Also, one of the examples will need editing.
Where we have...
var multipleValues = $( "#multiple" ).val() || [];
we can shorten it to...
var multipleValues = $( "#multiple" ).val();
Metadata
Metadata
Assignees
Labels
No labels