$.fn.hello = function(){ alert("hello" + this.val()); return this; //必须用return返回使得程序可以执行后面的步骤 } 然后在js中应用hello()方法