当我称之为这一习俗功能时,我会把这一功能称为这种习俗。
$.fn.inputBoxHelper = function () {
var args = arguments[0] || {};
var matchingElem = $.grep(this, function (e) { return $(e).val() == $(e).attr( title ); });
$(matchingElem).addClass(args.className);
this.bind({
focus: function(){
if ($(this).val().trim() == $(this).attr( title )) { $(this).val(emptyString).removeClass( gray ); }
},
blur: function(){
if ($(this).val().trim() == emptyString) { $(this).val($(this).attr( title )).addClass( gray ); }
}
});
return this;
}
和
$( input:text ).inputBoxHelper({ className: gray });
这给我带来了错误。
$("input:text,input:checkbox").inputBoxHelper is not a function
file:///D:/repository/scripts/script_tests/test.js
Line 20
即使在我改变职能时,也只是为了公正。
$.fn.inputBoxHelper = function () {return this;}
it does the same thing. It seems to run fine and work correctly as all the functionality works on the input boxes but get the error. Anyone have any ideas?