Part 3: Handling Multi Select Drop-down Created Using SELECT Tag

Hello Folks,

In current series of posts we have learnt:

Now, we will see how to handle multi select drop-down using Select class.

We will be using below html code of multi select drop-down:

When you will open above html file in a browser, you see as below:

Let’s see frequent operations performed on multi select drop-down:

How to check if any drop-down is single select or multi select:

  • Select class provides a method named isMultiple() which returns a boolean.
  • If drop-down is multi select, isMultiple() will return true otherwise false.

Code:

Output: