Sunday, March 25, 2012

Jquery How to Select a dropdown selected value

How to get drop down list selected value using jquery

When we start working with jquery ,we may think how and where we have to use jquery libraries.Before going to use jquery methods,we should download and add latest version of jquery plugin from out plug-in we could not use any methods of jquery reference.

In previous articles i have given Jquery Dropdownlist validation,JqueryUI autocomplete textbox.Jquery Get month or year,Hide and show div using jquery ,Jquery Declare variable.In this post i will show how to get the dropdownlist selected value using jquery.Below script will show  the selected value as alert while page loading

<html xmlns="">
<head runat="server">
<script src="" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
var ddlOrderText = $("#ddlChar option:selected").text();
alert(ddlOrderText );
var ddlOrderValue = $("#ddlChar option:selected").val();
<form id="form1" runat="server">
<asp:DropDownList ID="ddlChar" runat="server">

1 comment:

Anonymous said...

Thanks a lot.Save a lot time for me..