jQuery Get Selected Index Examples – 2 Ways

In jQuery, Tips and Tricks by May 30th, 2012

5484 Views

At times, it could be very useful to use jQuery to Get Selected Option Index value for carrying out relevant processing. In this article, I am going to show you a very easy and simple way to get selected option index value using jQuery. And the actual code is just 1 line, so it’s super easy to follow and implement.

Examples to Get Selected Option Index using jQuery

Let’s assume that you have a select dropdown with ID “countries”. To get the index of the selected option, you can use any of the following 2 methods:

Method 1: By using the ‘ID’ of the select dropdown:

Method 2: By using the ‘name’ of the select dropdown:

Example: Get Selected Option Index using jQuery

Very simple, isn’t it?

Do you know of any other ways to use jQuery to get selected index / get selected option index ? Feel free to suggest by commenting below.