Execute javascript when clicking the combobox

3

Is there any way I can run a script when I have a combobox open?

    
asked by anonymous 08.10.2015 / 13:06

1 answer

3

The click event you can implement as follows:

document.getElementById("combobox").addEventListener("click", eventoClick);

function eventoClick() {
    alert("teste do onclick")
}

There is also the change event that is when you switch the combobox options:

document.getElementById("combobox").addEventListener("change", eventoClick); 

function eventoChange(){
        alert("teste do change")
}

And also mouseover :

document.getElementById("combobox").addEventListener("mouseover", eventoMouseOver);

function eventoMouseOver() {
    alert("teste do mouseover")
}

Follow the jsfiddle

    
08.10.2015 / 13:15