Demo of Jquery functions and events for dropdownlist

JQuery provides us with a host of options and functionality while working with dropdown list. Below I have compiled some of the common jquery functions used with dropdown list.
While working on my website, I have used the following dropdown list in my admin section. I will reuse that dropdown list here for this demonstration. For demo, navigate to the end of this article.
<select id="ddlList">
<option value="1">Ajax</option>
<option value="2">ASP.NET</option>
<option value="3">C#</option>
<option value="4">Silverlight</option>
<option value="5">SQL</option>
<option value="6">jQuery/Javascript</option>
</select>
<br/><br/>
Get text or value
I have defined list of buttons below to get text or value of dropdown list
<input type="button" id="btnSelectedIndex" Value="Get Selected Index" />
<input type="button" id="btnSelectedText" Value="Get Selected Text" />
<input type="button" id="btnSelectedValue" Value="Get Selected Value" />
<input type="button" id="btnDropdownText" Value="Get all DropDown Text" />
<br/><br/>
Below is the associated jquery code.
$('#btnSelectedValue').click(function()\line alert($('#ddlList').val());
);
$('#btnSelectedText').click(function()\line alert($('#ddlList option:selected').text());
);
$('#btnDropdownText').click(function()\line alert($('#ddlList').text());
);
$('#btnSelectedIndex').click(function()\line alert($("#ddlList").get(0).selectedIndex);
);
Select item by index, value or text
Below is the set of buttons to select item by index, value or text of dropdown list
<input type="button" id="btnSelectLastElement" Value="Select Last Element" />
<input type="button" id="btnChangeSelectedIndex" Value="Select item at index 1" />
<input type="button" id="btnSetddlByValue" Value="Select item with value 3" />
<input type="button" id="btnSetddlByText" Value="Set DDL containing Text c#" />
Below is the associated jquery code.
$('#btnSelectLastElement').click(function() {
$("#ddlList option:last-child").attr("selected"