I know that there are similar questions but none of them change it onload dynamically.
The bar on my website shows the first option of the if I set it dynamically in onload function.
.value gives me the correct value but it doesnt get shown in the bar.
I cant use AJAX or JQuery because this is InLine Code on a website
function init(){
document.getElementById("selectRType").value = "Umfang";
}
<body onload="init()">
<select style="width: 100%; " id="selectRType">
<option value="Zeit">Zeit</option>
<option value="Ressourcen">Ressourcen</option>
<option value="Umfang">Umfang</option>
<option value="Sonstiges">Sonstiges</option>
</select>
</body>
2
Answers
In the end i used a component provided by the site i am working on, which saves the selected option into the database. The localStorage solution didnt work that well after testing. I cannot provide any info on the component, because i have no insight on the code in the background.
What if you try this instead?