lulu50
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.
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;
});
ASKER
Hi,
I want to say this:
if (GetOperatorSelectValue != "")
{
//append "GetOperatorSelectValue" value to the $("#ContidionsAndAttribute sTextArea" ).val()
}
if(GetConditionSelectValue != "")
{
//append "GetConditionSelectValue " value to the $("#ContidionsAndAttribute sTextArea" ).val()
}
etc...
I just want to add the values to the textarea if the user selected them
I want to say this:
if (GetOperatorSelectValue != "")
{
//append "GetOperatorSelectValue" value to the $("#ContidionsAndAttribute
}
if(GetConditionSelectValue
{
//append "GetConditionSelectValue " value to the $("#ContidionsAndAttribute
}
etc...
I just want to add the values to the textarea if the user selected them
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you
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?