I have the following code, the idea is that using interval select a value in a select and then assign a value to another select. But the change event that I should use is causing the page to refresh and loop. Any suggestions?
var interval = setInterval(doStuff, 3000); // 2000 ms = start after 2sec
function doStuff() {
chrome.storage.sync.get(null,
function(result) {
var item = JSON.parse(result.key);
var reg = document.getElementById('form1:layoutPanel1:layoutPanel2:regional_list');
reg.value = item.regional;
reg.dispatchEvent(new Event('change'));
var ciudad = document.getElementById('form1:layoutPanel1:layoutPanel2:ciudad_list');
ciudad.value = item.ciudad;
});
clearInterval(interval);
}