Heelo i have a question. I have a fetch function that that trigers oneditprepare and that gives me dropdown of 3 objects. next to it i have a button which works as "refresh server". Basically on btn click i call the fetch function again .The problem i have is that when i click the button it gives back same 3 objects below other objects. I want when i click on the btn to not have same objects shown
for (let i = 0; i < options.length; i++) {
let value = options[i].v;
let text = options[i].t;
$("#node-input-options").append(
$("<option></option>").attr("value", value).text(text) //For every element in the select tag append appropriate value and text ( <option value="#">#</option> )
);
}
This fills the dropdown
const btnrefreshServer = $(".refreshserverItems");
btnrefreshServer.on("click", (evn) => {
let select = document.getElementById("node-input-options");
let length = select.options.length;
for (let i = length - 1; i >= 0; i--) {
select.options[i] = null;
}
setTimeout(fetchUrl, 1000);
I tried like that but it doesnt work