Home » Javascript15 October 2012

Javascript: Get Select Dropdown Option Value on Button on Click

This article shows how to get selected value from dropdown box when a button is clicked.

Problem:

– There are multiple forms in a page.
– There is a dropdown select box in each form.
– The option value of the select box is website URL.
– There is a button type=button (not type=submit) in each form.
– User will select a value from the select box and click the button.
– I need to get the selected option value (which is website URL) and open the URL in new window.

Solution:

Here is my sample of multiple forms.

Here is the Javascript.

PS: This website is a great help for Javascript Coding – http://www.javascript-coder.com/javascript-form/javascript-form-submit.phtml

Thanks.

Javascript

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • JBC

    Thank you! It was the solution I was looking for.