I have three multi-select dropdown lists and after selection from these dropdown list user press the submit button and the list text show in textarea but if user change some text in textarea and then again select another list from the dropdown then press submit the text is not changing in textarea.
I tried some solutions such as one the guy said use $("#total_selections").val("");
instead of $("#total_selections").html("");
but after this nothing is showing in textarea.
<div class="form-group">
<button type="button" class="btn btn-primary" id="selection_button" disabled>Select Tags</button>
</div>
@Html.TextAreaFor(m => m.Formula, new { @class = "form-control", id = "total_selections" })
$("#selection_button").click(function () {
$("#tag_creation").prop('disabled', false);
$("#total_selections").val("");
SelectedItemArray();
});
});
function SelectedItemArray() {
var datas = new Array();
var datas = $('.add_item option:selected').map(function ()
{
return $(this).text() || undefined;
}).get();
$.ajax({
url: "@Url.Action("selectedTags","CalculatedTags")",
type: 'Post',
contentType: 'application/json',
dataType: 'json',
data: JSON.stringify({ 'selectedTags': datas }),
success: function (data) {
$("#total_selections").append(data);
}
});
}