Question: how to get selected value from dropdown in jsp?
Answer: var sel = document. getElementsByName('item'); var sv = sel. value; alert(sv); The only reason your code might fail is when there is no item selected, then the selectedIndex returns -1 and the code breaks.