Link to home
Start Free TrialLog in
Avatar of lulu50
lulu50Flag for United States of America

asked on

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

Hi,

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

Avatar of Montoya
Montoya

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?
Avatar of lulu50

ASKER

Hi,

I want to say this:

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

I just want to add the values to the textarea if the user selected them
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America 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 lulu50

ASKER

Thank you