How can I say if the dropdown list has been selected then add the value or text to a textarea?

lulu50 used Ask the Experts™

How can I say if the dropdown list has been selected then append the value or the text to the textarea box.

I'm using bootstrap dropdown list.

  $("#AppendConditionBtn").click(function () {

            var RangeBoxFrom = $("#RangeBoxFrom").val().length;
            var RangeBoxTo = $("#RangeBoxTo").val().length;
            var GetOperatorSelectValue = $("#OperatorSelect option:selected").val();
            var GetConditionSelectValue = $("#ConditionSelect option:selected").text();
            var GetValueSelectValue = $("#ValueSelect option:selected").val();
            var GetGroupSelectValue = $("#GroupSelect option:selected").text();
            var GetItemsTextAreaValue = $("#ItemsTextArea").val();
            var GetOperatorSelectForRangeValue = $("#OperatorSelectForRange option:selected").val();
            var GetConditionSelectForRangeValue = $("#ConditionSelectForRange option:selected").val();
            var GetValueSelectForRangeValue = $("#ValueSelectForRange option:selected").val();
            var GetRangeBoxFromValue = $("#RangeBoxFrom").val();
            var GetRangeBoxToValue = $("#RangeBoxTo").val();

             if (RangeBoxFrom > 6 || RangeBoxTo > 6) {
                 alert("Range should be less than 6 character");
                 return false;

// Here how can I say if the multiselectbox list has been selected then append the value or text to the "ContidionsAndAttributesTextArea"
otherwise don't append. 

             $("#ContidionsAndAttributesTextArea").val(GetOperatorSelectValue + " " + GetConditionSelectValue
                 + " " + GetValueSelectValue + " " + GetGroupSelectValue + " (" + GetItemsTextAreaValue + ") "
             + GetOperatorSelectForRangeValue + " " + GetConditionSelectForRangeValue + " " + GetValueSelectForRangeValue
             + " (" + GetRangeBoxFromValue + " - " + GetRangeBoxToValue + ") ");

              return true;


Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
MontoyaProcess Improvement Mgr

Hi there,

To clarify, are you saying that you want to capture the value of an item in a dropdown list? Or, are you trying to say that if the dropdown list itself has focus?
lulu50Web application



I want to say this:

if (GetOperatorSelectValue  != "")
   //append "GetOperatorSelectValue"  value to the  $("#ContidionsAndAttributesTextArea").val()
if(GetConditionSelectValue != "")
   //append "GetConditionSelectValue "  value to the  $("#ContidionsAndAttributesTextArea").val()

I just want to add the values to the textarea if the user selected them
Developer & EE Moderator
Fellow 2018
Most Valuable Expert 2013
<!DOCTYPE html>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <select id="test" multiple>
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
    <option value="opel">Opel</option>
    <option value="audi">Audi</option>
  <textarea id="results"></textarea>
<script src=""></script>
    var test=$(this).val();

Open in new window

lulu50Web application


Thank you

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial