Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[JavaScript] Auswahl aus Select-Feld direkt anzeigen lassen

Empfohlene Antworten

Veröffentlicht

Hallo,

leider bin ich absolut kein JavaScript-Freak brauche aber folgende Funktion:

Ich habe mehrere Select-Felder (Auswahllisten) und möchte, dass jede Auswahl direkt auf der Seite angezeigt (ohne dass die Seite neu geladen wird) wird. Also nochmal extra angezeigt wird und nicht nur in der Auswahlliste. Ist das möglich und wenn ja wie?

Viele Grüße

Ich habe eine Auswahlliste:

<select name="test">

<option value="">- Nicht gewählt -</option>

<option value="1">Ja</option>

<option value="2">Nein</option>

</select>

Der Benutzer wählt z.B. jetzt "Nein" aus. Ist es möglich, dass unterhalb der Select-Box (meinetwegen in einem DIV) diese Auswahl ("Nein") direkt angezeigt wird, ohne dass ich die Sachen erst abschicken muss und die Seite durch einen Button neu laden muss?


<script>

function getSelect() {

	inhalt = document.getElementById("getText").value;


    feld = document.getElementById('text');

	feld.innerHTML = inhalt;


}


</script>


<select name="test" onChange="getSelect()" id="getText">

	<option value="">- Nicht gewählt -</option>

	<option value="1">Ja</option>

	<option value="2">Nein</option>

</select>


<br>

<br>

<div id="text"></div>

Danke... aber leider passiert gar nichts.

und beim FireFox in der JavaScript-Konsole kommt der Fehler:

Fehler: getSelect is not defined

Quelldatei: javascript:alert('TODO: FIXME')

bei mir gehts in ie und ff 1a.. zeig mal dein code

Sauber danke... geht jetzt bei mir auch...

Danke

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.