Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

dropdown menu to populate a textarea

Posted on 2008-06-11
5
727 Views
Last Modified: 2013-11-19
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

0
Comment
Question by:dlcnet
  • 3
  • 2
5 Comments
 
LVL 63

Expert Comment

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

Open in new window

0
 

Author Comment

by:dlcnet
ID: 21762390
@ Zvonko:
 Thanks! It works, but it adds the 2nd option after the 1rst one. I would like to have it on the next row.
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 500 total points
ID: 21762409
Check this:
function select(source,dest) {
                var destFeld = document.getElementById(dest);
                destFeld.value += source.value+'\n';
    }

Open in new window

0
 

Author Comment

by:dlcnet
ID: 21762473

 @ Zvonko: Many thanks for the quick solution!
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 21762488
You are welcome.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
document.write() deleting all existing HTML 5 50
Hide cell in a table 2 27
Index on a Table 6 25
jquery tab header text 1 23
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question