Skip to content
Advertisement

Display text of select option with button jQuery

Hello guys i have a question here. So in this problem i can’t display the text from selected option while i click order button. For the result i need the selected option i choose and display it into a div. Any suggestion what i must change or add here?

P.S : Sorry i’m still learning here, i hope my question didn’t confuse anyone here..

html

JavaScript

js

JavaScript

Advertisement

Answer

You should declare the array outside the click handler function. Also , you probably want to store the label attribute of the selected option. Join the array items with , before showing in the element:

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