Getting `defaultSelected` instead of `selected` in HTML
See original GitHub issueHi,
I have a weird issue, where I am not able to use defaultXXX
, ie defaultSelected
.
I am using Reef 7.6.6 in Electron app and I am not doing anything fancy:
<select name="type">
<option ${reminder.type === 'repeat' ? 'defaultSelected' : ''}>repeat</option>
<option ${reminder.type === 'once' ? 'defaultSelected' : ''}>once</option>
<option ${reminder.type === 'cron' ? 'defaultSelected' : ''}>cron</option>
</select>
I tried to reproduce in codepen, but everything works fine there.
I noticed, though, that in codepen the resulting value in html is selected
, while in my project I am getting defaultselected
.
<option defaultselected="">once</option>
<option selected="">once</option>
Not really sure where to look, I must be doing some rookie mistake.
Issue Analytics
- State:
- Created 3 years ago
- Comments:17 (11 by maintainers)
Top Results From Across the Web
How can I set the default value for an HTML <select> element?
It turns out that if you are using React, then setting selected doesn't work. Instead you have to set a value in the...
Read more >How to set the default value for an HTML <select> element
The option tag contains the value that would be used when selected. The default value of the select element can be set by...
Read more >HTML DOM Option defaultSelected Property - W3Schools
The defaultSelected property returns the default value of the selected attribute. This property returns true if an option is selected by default, otherwise...
Read more >How to set the default value for an HTML ... - Educative.io
You can choose your default value by setting your default value of choice to selected , as shown below.
Read more >Select Default Value in HTML | Delft Stack
We can use the selected="selected" option to select default value in an HTML code. We write the selected attribute in the <option> tag....
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 FreeTop 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
Top GitHub Comments
Alright, this should be resolved with v8.0.3.
Oh, and thanks for the reduced test case. Super helpful!