Here I am going to show you some example with explanation that how to change a dropdown box value in jquery.

Suppose I have html element having select dropdown and I want to change the dropdown selected value on some change event.Also I can set dropdown value
value manually when I want or where I want.In the same I can get the selected value and its text or label value through jQuery.

So I have shown on below with some examples please check below details for working on dropdown select box.
Here I have a simple select /dropdown box having id=”name” and more number of options having values as well as labels/text.
Before doing everything your site needs contain latest jQuery plugin unless below examples won’t work.
[crayon-5e43ab5b7dcfa479740781/]

1) To get slected dropdown value:
[crayon-5e43ab5b7dd03163075530/]

2) To set dropdown value to your name ‘Jyoti’.

[crayon-5e43ab5b7dd07720140699/]

3) To set dropdown value to another name ‘Jyotiranjan’.

[crayon-5e43ab5b7dd0b470841705/]

4) To disable jyotiloppy option in dropdown down box.

[crayon-5e43ab5b7dd0e054441111/]

5) To enable jyotiloppy option in dropdown down box.

[crayon-5e43ab5b7dd12214603254/]
[crayon-5e43ab5b7dd16785857745/]

Live Demo


Click To Run

how to change a dropdown box value in jquery
The following two tabs change content below.
Jyotiranjan is one of passionate programmer who has been working in magento since 6 years and in the mean time he has developed enormous amount of modules and customisation of sites. He loves to write blogs and travel for long journeying.

Latest posts by Jyotiranjan Biswal (see all)

Tagged on:     

Leave a Reply

Your email address will not be published. Required fields are marked *