Skip to content
Advertisement

Why selectedIndex doesn’t work in my code?

I have a following, easy example:

JavaScript

when I choose option on my list then no alert pops-up. I also tried with:

JavaScript

but can’t return index number of given option. When I use .text instead of .index (to get text from option) it also doesn’ work

Advertisement

Answer

There is a syntax issue (missing the addEventListener closing parenthesis).

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement