question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting `defaultSelected` instead of `selected` in HTML

See original GitHub issue

Hi,

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:closed
  • Created 3 years ago
  • Comments:17 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
cferdinandicommented, Feb 4, 2021

Alright, this should be resolved with v8.0.3.

1reaction
cferdinandicommented, Feb 1, 2021

Oh, and thanks for the reduced test case. Super helpful!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found