mardi 24 novembre 2020

conditional dropdown menus

I am trying to figure out how to have that if you select something in my dropdown menu, It will write in the HTML 'You want .....'

Here is my code

function latte1() {
  if (document.getElementById("latte").click) {
    alert("You like Latte")
  } else {
    document.write("You like Something else")
  }
}
<option id="latte" onclick="latte1()">Latte</option>

Any help is appreciated

Aucun commentaire:

Enregistrer un commentaire