Wenn man im Selectfeld was aussucht, wird der Inhalt des Selects an der Stelle im Textarea kopiert wo man gerade am Schreiben ist
Kommentar abgeben zu diesen Beitrag/Code ?
Dann hier klicken

Der hier verwendete Code

<!DOCTYPE html> <html> <head> <title>From Select to Textarea</title> <style> body{ text-align:center; } textarea{ width:60%; height:200px; ont-size:30px; } h1{ text-decoration:underline; } select{ height:60px; width:30%; font-size:40px; } </style> </head> <body> <h1>Aus Dropdown in Textarea Einfügen</h1> <textarea id="text"></textarea><br> <select id="selec"> <option value=""> --- Auswahl --- </option> <option value="peter">Peter</option> <option value="heiz">Heinz</option> <option value="Jürgen">Jürgen</option> <option value="Stefan">Stefan</option> <option value="Basti">Basti</option> </select> <script> document.getElementById('selec').onchange=function(){ var text=document.getElementById('text').value; var select=document.getElementById('selec').value; document.getElementById('text').value=text+''+select+''; } </script> </body>

Add Comment

* Required information
1000
Drag & drop images (max 3)
Powered by Commentics

Comments

No comments yet. Be the first!