Link to home
Start Free TrialLog 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
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dlcnet

ASKER


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