Monday, August 8, 2011

Simple jQuery Plugin to Clear Dropdownlist options


$.fn.clearOption = function  () {
var  currentId = $(this ).attr( );
document.getElementById(currentId).options.length = 0;
};
 
paste this code in a external js file. clear the option element
of a Dropdownlist using the folowing jQuery syntax.

$("#Dropdownlist1" ).clearOption();


No comments:

Post a Comment