jQuery API 返回首页目录 | jQuery API 中英文对照版
focus(fn)
focus(fn)

在每一个匹配元素的focus事件中绑定一个处理函数。

返回值:jQuery

参数:

  • fn (Function): 在每一个匹配元素的submit事件中绑定的处理函数。

示例:

$("p").focus( function() { alert("Hello"); } );

HTML 代码:

<p>Hello</p>

结果:

<p onfocus="alert('Hello');">Hello</p>

 
focus(fn)

Bind a function to the focus event of each matched element.

Return value: jQuery
Parameters:
  • fn (Function): A function to bind to the focus event on each of the matched elements.

Example:

 $("p").focus( function() { alert("Hello"); } );  
Before:
 <p>Hello</p>  
Result:
 <p onfocus="alert('Hello');">Hello</p>  


相关链接
asp之家 | jQuery官方网站 | jQuery中文网 | 电子书作者网站 | 电子书作者blog