jQuery DropDownList


InterServer Web Hosting and VPS
Sony Playstation PS4 Pro Custom Build NVMe SSD Drive - Enclosure case and Crucial NVMe SSD
PS4 Pro Custom External SSD NVMe Drive

How I built a PS4 Pro Custom External SSD NVMe Drive...

NUC8i7BEH with memory
Intel NUC8I7BEH Review and Custom Build

This is my review of the Intel NUC8i7BEH and a summary of my build...

Card image cap
Asus M5A88-M EVO Review

This is my review of the Asus M5A88-M EVO motherboard...

Corsair Vengeance Blue 8GB (2x4GB) DDR3 PC3-12800C9 1600MHz Dual Channel Kit
Corsair Vengeance Blue Review

This is my review of the Corsair Vengeance Blue 8GB (2x4GB) DDR3 PC3-12800C9 1600MHz Dual Channel Kit memory...

Robotic Arm with USB PC Interface Review
Robotic Arm with USB PC Interface Review

This is my review of the Robotic Arm with USB PC Interface...

jQuery DropDownList

Here we look at jQuery DropDownList, that is using jQuery to get access to a .NET DropDownList control's selected value.

In ASP.NET, we'd probably look at the selected value of a dropdownlist on the server after a postback, however, recent trending is pushing more processing work to the browser client, so we may find ourselves actually using jQuery to view a DropDownList's selected value whilst on the client and reacting to the selection at this point in time.

jQuery DropDownList Selected Value

The code below shows how to access the .NET DropDownList's selected value:


  selectedColour = $('#DropDownList_Colour option:selected').text();


So we call jQuery, ($), specify the ID of the control using the jquery selector for id, '#' (DropDownList_Colour). 'option:selected' states a more specific target, (a DropDownList is a SELECT list of OPTIONS in HTML) so this gets the selected option, and finally .text() gets the text content of the element.

Sponsored Links
SolarSystem - AngularJS Demo
SolarSystem - Angular JS Demo

Check out my first Angular JS demo hosted in Azure, it helped win my first Angular contract. Put the sound on.