JS oder Prototype - select field checken
alkativo
- javascript
0 Hansi0 alkativo0 minicrispie0 Hansi
0 ChrisB
Hi,
für eine Edit Funktion möchte ich den Wert in einem select fiel vorauswählen.
<select id="select">
<option selected="selected" value="0">keine Auswahl</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
Wie mache ich das mit JS?
document.getElementById("select")[0].checked = true;
Bitte helft mir. Danke.
Cucu
Al
document.getElementById("select")[0].checked = true;
>
> Bitte helft mir. Danke.
~~~javascript
document.getElementById("select")[0].selected;
... so aus dem Kopf ... müsste es klappen ...
Sehr gut
document.getElementById("selected1").selected = true;
Element eine id geben und los gehts...danke
Hallo,
Sehr gut
document.getElementById("selected1").selected = true;
Element eine id geben und los gehts...danke
nein. Für sowas gibt es http://de.selfhtml.org/javascript/objekte/options.htm#selected_index@title=selectedIndex.
MfG. Christoph Ludwig
nein. Für sowas gibt es http://de.selfhtml.org/javascript/objekte/options.htm#selected_index@title=selectedIndex.
Stimmt da war doch was ;)
document.getElementById("selected1").selectedIndex = 0;
Hi,
für eine Edit Funktion möchte ich den Wert in einem select fiel vorauswählen.
Wie mache ich das mit JS?
In dem du dich informierst, statt zu fragen.
http://de.selfhtml.org/javascript/objekte/options.htm
MfG ChrisB