ItSolutionStuff.com

JQuery Get Selected Dropdown Value on Change Event Example

By Hardik Savani • July 13, 2023
jQuery

With JQuery, we can get easily select option value onchange event in jquery. if you have question like how to get select option value on change jquery than here you will have simple example of get selected value of dropdown in jquery on change event.

In this example, i will create very simple dropdown box with some websites lists. I will add "sel" class for select box. On class i will write change event and get selected dropdown value using val() function and alert it.

You can see jquery logic code here:

$(".sel").change(function(){

var selValue = $(this).val();

alert(selValue);

});

So, let's see bellow simple example so it will helpful for you.

Example:

<!DOCTYPE html>

<html>

<head>

<title>Jquery Get Selected Dropdown Value on Change Event Example - ItSolutionStuff.com</title>

<script src="https://code.jquery.com/jquery-1.12.4.js"></script>

</head>

<body>

<h3>Jquery Get Selected Dropdown Value on Change Event Example</h3>

<select name="webste" class="sel">

<option>--Select Website--</option>

<option value="it">ItSolutionStuff.com</option>

<option value="hd">HDTuto.com</option>

<option value="nice">NiceSnippets.com</option>

</select>

<script type="text/javascript">

$(".sel").change(function(){

var selValue = $(this).val();

alert(selValue);

});

</script>

</body>

</html>

I hope it can help you...

Tags: jQuery
Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

JQuery Moment Add Year to Date Example

Read Now →

JQuery Moment Get Current Date Example

Read Now →

JQuery Open Link in New Window Example

Read Now →

JQuery Disable Submit Button on Click to Prevent Multiple Form Submits

Read Now →

JQuery Toggle Hide Show Div on Click Event Example

Read Now →

How to Remove Key Value from Array using JQuery?

Read Now →

How to Get Selected Radio Button Value in JQuery?

Read Now →

JQuery Redirect to Another Page After 5 Seconds Example

Read Now →

How to Remove Empty or Null Values from JSON using JQuery?

Read Now →

How to Disable Browser Back Button using JQuery?

Read Now →

Automatically Scroll to Bottom of Div JQuery Example

Read Now →

Check and Uncheck All Checkbox using JQuery Example

Read Now →

How to Allow Only One Checkbox Checked at a Time in JQuery?

Read Now →

How to Convert Line Breaks to br in jQuery ?

Read Now →