jquery中设置Prototype为什么报错啊?jquery网站上是这样做的
var form = $("#myform");
form.prototype.clearForm = function() {
return this.find(":input").each(function() {
this.value = "";
}).end();
};
form.clearForm() // works for all instances of jQuery objects, because the new method was added to the prototype
firebug提示:
form.prototype is undefined
html代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
可以把
[quote]form.prototype.clearForm[/quote]
改为
[code="java"]$.prototype.clearForm [/code]
或
[code="java"]form.clearForm[/code]