selectedIndex method is showing the right alert but i am not getting the value back. I get the jquery object back. How can i change it so that i get the value back for the selectedIndex method?
jQuery.fn.dropdownHelper = function(method) {
var methods = {
init: function(){ },
empty: function(){
if (this.tagName == 'SELECT')
this.options.length = 0;
},
selectedIndex: function(){
var index = this.selectedIndex;
if(index == 'undefined')
index = -1;
alert (index);
return index;
}
};
return this.each(function() {
// Method calling logic
if ( methods[method] )
return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
else if ( typeof method === 'object' || ! method )
return methods.init.apply( this, arguments );
else
$.error( 'Method ' + method + ' does not exist' );
});
};