Link to home
Create AccountLog in
Avatar of dlcnet
dlcnetFlag for United Kingdom of Great Britain and Northern Ireland

asked on

dropdown menu to populate a textarea

Hi Experts!

 I have a question realted to a dropdown menu which populates a textfield. I have the following code. The problem is the following:
I have 4 options in the dropdown menu. The textarea must be populated with only 2 selected options.
When I change the option from the dropdown it also changes in the textarea overwritting the previous selected one. I wanted that the first option selected is still there and the 2nd is added after the first one.
How this can be done?

Thank you in advance!
function select(source,dest) {
                var destFeld = document.getElementById(dest);
                destFeld.value = source.value;
    }

Open in new window

Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Like this:
function select(source,dest) {
                var destFeld = document.getElementById(dest);
                destFeld.value += source.value;
    }

Open in new window

Avatar of dlcnet

ASKER

@ Zvonko:
 Thanks! It works, but it adds the 2nd option after the 1rst one. I would like to have it on the next row.
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of dlcnet

ASKER


 @ Zvonko: Many thanks for the quick solution!
You are welcome.