Get id of selected dropdown value in jquery

Solution

var selectedid=$("#dropdownname").find('option:selected').attr('id');

Explanation

This will find the id of selected dropdown option and store it in the variable selectedid.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at WordPress.com.

Up ↑

Create your own website, free on WordPress.com.Create your own website.
Start free