All DropDown

Validate ASP.NET DropDownList using jQuery

In this small post, today I will show you how to validate ASP.NET DropDown List using jQuery. Let's declare a DropDownList. <asp:DropDownList ID="ddlList" runat="server"> <asp:ListItem Text="Select" Value="0" /> <asp:ListItem Text="jQuery" Value="1"></asp:ListItem> <asp:ListItem Text="JavaScript" Value="2"></asp:ListItem> <asp:ListItem Text="Prototype" Value="3"></asp:ListItem> <asp:ListItem Text="Dojo" Value="4"></asp:ListItem> <asp:ListItem Text="Mootools" Value="5"></asp:ListItem> </asp:DropDownList> To validate the dropdown list, all you need to do is […]
Read the rest of this entry »

Fix for “IE Select DropDown with Fixed width issue” using jQuery

Today I found another reason to hate IE. I ran into an issue where Select DropDown with Fixed width cuts off the options text (if it is wider than the assigned width) only in IE (Internet Explorer). In this post, I will show you the fix for this problem using JavaScript and jQuery both. Problem […]
Read the rest of this entry »

How to Disable DropDown List Item using jQuery

In this post, I will show you how you can disable specific items of the DropDown/ComboBox/Select element using jQuery. To disable any item, just need to add attribute "disabled" with value "disabled" to the list item. //Code Starts $(document).ready(function() { $("#ddlList option[value='jquery']").attr("disabled","disabled"); });? //Code Ends See result below. You can also disable item by their […]
Read the rest of this entry »

How to add images in DropDown List Items using jQuery

DropDown contains list of items out of which user can select one. But have you ever thought of having images along with the description? For example, showing country flag image with country name in dropdown. It will look more attractive and eye catching. But How to do it? Well, there is a jQuery Plugin "ddSlick" […]
Read the rest of this entry »

Add default option to ASP.NET Dropdown list using jQuery

Sometimes It is required to add default option like "Please Select" or "Select" in Dropdown list. Below is a simple jQuery code to "add default option to ASP.NET Dropdown list using jQuery". //Code Starts $(document).ready(function(){ var defaultOpt = "<option selected='selected' value='-1'>--Select--</option>" $('#<%=ddlCountry.ClientID %>').prepend(defaultOpt); }) //Code Ends And if you want to add default option to […]
Read the rest of this entry »

How to Reset dropdown using jQuery

In this post, you will find various ways to reset the dropdown using jQuery. These are one line of jQuery code, which can reset the dropdown. Below code will find the first item in the list and make it selected. $('#DropDownList1').find('option:first').attr('selected', 'selected'); Below code will find the item with value o and selects it. If […]
Read the rest of this entry »

Responsive Menu
Add more content here...