[quote=引用 1 楼 ghoslation 的回复:] $(":text").focus( check($(this)) ) 这个语句执行顺序是 1。选取所有text对象 2。执行check函数 3。将check函数的结果邦定在focus事件上 所以这一语句执行之后, 事实上check函数已经被执行。 解法: $(document).ready(function() { $(":text").focus(function (){ $this = $(this); $this.css("display","none"); alert("hello"); }); });
$(document).ready(function() { $(":text").focus(function(e) { check($(this)); }); function check(obj){ obj.css("display","none"); alert("hello"); } });
$(":text").focus(function(){ check($(this)); });
$(":text").focus( check($(this)) ) 这个语句执行顺序是 1。选取所有text对象 2。执行check函数 3。将check函数的结果邦定在focus事件上 所以这一语句执行之后, 事实上check函数已经被执行。 解法: $(document).ready(function() { $(":text").focus(function (){ $this = $(this); $this.css("display","none"); alert("hello"); }); });
87,997
社区成员
224,709
社区内容
加载中
试试用AI创作助手写篇文章吧