Moin,
ich habe ein select menü, in welchem ich per javascript die ausgewählte Option ändern möchte, also folgendermaßen:
HTML
<!DOCTYPE html>
<html>
<head>
<title>Beispiel HTML-Grundgerüst für jQuery Mobile</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"
rel="stylesheet">
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<link rel="stylesheet" href="style.css">
<script>
function load(){
document.getElementById("select1").value = "option2";
}
</script>
</head>
<body onload="load()">
<select name="select" id="select1">
<option value="option1">Option1</option>
<option value="option2">Option2</option>
<option value="option3">Option3</option>
</select>
</body>
</html>
Alles anzeigen
Es wird zwar der value-Wert übernommen, angezeigt wird aber trotzdem "Option1".
Kann mir jemand helfen?