May 4, 2014 by Nitesh

How To Select Text and Value from Drop Down List in jQuery

Friends,

This post is a very simple tip for getting the selected text and selected value from a drop down list using jQuery. A very common usage and we use it in almost every project that we do. To start with, let us consider we have a drop-down list with ID “numbers”. The DOM structure of the select list something looks like below.


To get the selected text and value for this drop down list, we can use the below piece of code.

var text = $("#numbers option:selected").text();
var value = $("#numbers option:selected").val();
alert("Selected text=" + text + " Selected value= " + value);

Keep learning and sharing!

#ASP.Net#Javascript#jQuery#PhP

Support us!

If you like this site please help and make click on any of these buttons!

Powered by WordPress Popup