I want to get the default value of the dropdown bar using javascript.
In the code below
alert(document.getElementById("dropdown").selected)
<select id="dropdown">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="vw">VW</option>
<option value="audi" selected>Audi</option>
</select>
the audi option is by default selected value of the drop-down bar. with help of document.getElementById("drop-down").value=""
we can get the value the user has selected(say it is Saab) but I want to get the default value of that particular drop-down bar(i.e audi)
I tried using document.getElementById("selement").selected
but it doesn't seem to be working
I want to get the default regardless of what the user selects. I have two tabs. the first tab has this drop down. When the user moves onto the next tab the drop-down in the first tab should display the default value (such as "select any options below" or in the case of the example , "audi") but for me the drop-down shows the one which the user had selected previously before the tab was changed. So is there a way where I can get the value 'audi' through JS ?