[SOLVED] custom Plugin not working
ok so i sorted this problem out my self by adding each instance to its own object
why did i not think about that before
behold ne code
-
(function($){
jQuery.fn.showhideinput = function(options) {
var defaults = {
text: "Enter Text Here"
};
var options = $.extend(defaults, options);
var obj = new Object();
return this.each(function(index) {
obj[index] = $(this);
var inputtext = obj[index].val();
obj[index].css({'font-weight':'Bold',
'padding-left': '3px'});
if (inputtext == ''){
obj[index].val(options.text);
inputtext = options.text;
}
obj[index].focus(function () {
if (obj[index].val() == inputtext){
obj[index].val('');
}
});
obj[index].blur(function () {
if (obj[index].val() == ''){
obj[index].val(inputtext);
}
});
});
};
})(jQuery);