Cannot specify default selected options for <select multiple />
See original GitHub issue/** @jsx React.DOM */
var MultipleSelect = React.createClass({
render: function() {
return <select multiple>
<option value='1' selected>A</option>
<option value='2' selected>B</option>
<option value='3' selected>C</option>
</select>;
}
});
React.renderComponent(<MultipleSelect />, document.body);
Expect option A, B and C are selected by default but they are not.
Issue Analytics
- State:
- Created 10 years ago
- Reactions:2
- Comments:6 (4 by maintainers)
Top Results From Across the Web
How can I set the default value for an HTML <select> element?
Provide "selected" keyword inside the option tag, which you want to appear by default in your drop down list. Or you can also...
Read more >Cannot select multiple objects in AutoCAD
On the Cursor & Selection tab, clear the Use Shift key to add to selection option. User-added image; Choose OK to close the...
Read more >Setting default values in a question with multiple dropdowns ...
Yes, Correct. If the first select has a value "Blank option/Select text" then the second select/dropdown has a no values. It will be...
Read more >Not able to set multi-select default values on a form?
Post a question about using the core Smartsheet application: Sheets, Forms, Reports, Dashboards, and more.
Read more >How to set the default value for an HTML <select> element
The select tag in HTML is used to create a dropdown list of options that can be selected. The option tag contains the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@zpao The docs on forms could be clearer by mentioning that you can put an array into the
value
attribute (the usage example is likely to be<select multiple>
).I think you forgot to save your jsfiddle, but as the console warning you get says,
In this case, you want
<select multiple value={['1', '2', '3']}>
or withdefaultValue
if you want an uncontrolled component. For more info, see the docs on forms.