Set default option in combobox

Hi, from this page, field “Biblioteca/Sistema”, I’m trying to set “RMB02” as default option value. The below userscript works on top right field “Digita o seleziona una biblioteca”, but I would like to apply it to field “Biblioteca/Sistema”, that has the same selectors.

function wait() {
        if(document.querySelector("button[class='syw-comboselect-trigger']") == null) {
            setTimeout(wait,1000);
        } else {
            document.querySelector("button[class='syw-comboselect-trigger']").click();
            document.querySelector("li[data-group='GR_10'] a[title]").click();
            document.querySelector("li[data-cd='RMBO2'] a[class='select']").click();
           }
    }
wait();

Thank you!

Then your problem is the selectors :wink:

try sticking .riga-biblioss at the start of each of them, so that the script finds the correct button/li to push.

1 Like

It works now, thank you m_hutley, I had lost the dot!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.