JSFiddle - React, Tailwind, and code Playground
HTML
<button onclick="loadListA();">Load A</button>
<button onclick="loadListB();">Load B</button>
<select name="" id="items">
</select>
JavaScript
function option(value,text){
this.val= value;
this.text = text;
}
var listA=[];
var listB=[];
//you just have to fill the listA and listB by razor Code
//@foreach (var item in Model.ThirdParties)
//{
// <text>
// listA.push(new option('@item.Value', '@item.Text'));
// </text>
// }
//@foreach (var item in Model.Accounts)
// {
// <text>
// listA.push(new option('@item.Value', '@item.Text');
// </text>
// }
listA.push(new option(3,"a"));
listA.push(new option(2,"b"));
listA.push(new option(3,"c"));
listB.push(new option(4,"x"));
listB.push(new option(5,"y"));
listB.push(new option(6,"z"));
function loadListA(){
$("#items").empty();
listA.forEach(function(obj) {
$('#items').append( $('<option></option>').val(obj.val).html(obj.text) )
});
}
function loadListB(){
$("#items").empty();
listB.forEach(function(obj) {
$('#items').append( $('<option></option>').val(obj.val).html(obj.text) )
});
}