Skip to content Skip to sidebar Skip to footer

Append Dropdown Box Selections To A Textbox

I am wondering if someone can point me in the right direction for what I am looking for... Basically, I would like to have 3-5 dropdown boxes (and maybe 2 textboxes) with each the

Solution 1:

To achieve this, you would have to create a function that gathers all the values then formats them in the way you want.

An example of this would be:

functiongenerate(){
    var result = '';

    result += document.getElementById('drop1').value + ' - ';
    result += document.getElementById('drop2').value + ' - ';
    result += document.getElementById('drop3').value + ' - ';
    result += document.getElementById('text1').value + ' - ';
    result += document.getElementById('text2').value;

	document.getElementById('output').innerHTML = result;
}
generate();
<selectid="drop1"onchange="generate()"><optionvalue="d1s1">D1 S1</option><optionvalue="d1s2">D1 S2</option></select><selectid="drop2"onchange="generate()"><optionvalue="d2s1">D2 S1</option><optionvalue="d2s2">D2 S2</option></select><selectid="drop3"onchange="generate()"><optionvalue="d3s1">D3 S1</option><optionvalue="d3s2">D3 S2</option></select><inputid="text1"type="text"value="text1"onchange="generate()"onkeyup="generate()" /><inputid="text2"type="text"value="text2"onchange="generate()"onkeyup="generate()" /><pid="output"></p>

Post a Comment for "Append Dropdown Box Selections To A Textbox"