I am completely new to JavaScript, so far i have been able to learn how to get values from my select drop down. However one other thing I would like to do is have a default value which gets displayed when a user visits the page. Then change with the select action. Currently I get no value displayed until after selecting from the drop down. I have tried to search but i have not found any easy to understand guide on how to implement this. See my code below
function val() {
d = document.getElementById("select_year").value;
document.getElementById("demo").innerHTML = d;
}
<select onchange="val()" id="select_year">
<option selected value="2017">2017</option>
<option value="2016">2016</option>
<option value="2015">2015</option>
</select>
<p id="demo"></p>