focus

UK[?f??k?s] US[?fo?k?s]

vt.& vi. (to make) focus, (to make) gather; adjust (lens, eyes) ) focus [focal length] in order to see clearly

vt. adjust the focal length (of the eye or lens); focus (the beam on); focus, gaze; concentrate

n. focus; image clarity; center (of activity, attention, interest, etc.); [medicine] focus, disease

jquery focus() method syntax

Function:When an element gains focus, the focus event occurs.

Trigger focus event syntax: $(selector).focus()

##Bind the function to the focus event syntax: $ (selector).focus(function)

Parameters:

##Parametersfunction

jquery focus() method example

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("input").focus(function(){
    $("input").css("background-color","#FFFFCC");
  });
  $("input").blur(function(){
    $("input").css("background-color","#D6D6FF");
  });
});
</script>
</head>
<body>
Enter your name: <input type="text" />
<p>請?jiān)谏厦娴妮斎胗蛑悬c(diǎn)擊,使其獲得焦點(diǎn),然后在輸入域外面點(diǎn)擊,使其失去焦點(diǎn)。</p>
</body>
</html>
Run instance ?

Click the "Run instance" button to view the online instance


Description
Optional. Specifies the function to be run when the focus event occurs.?
<center id="rzqkk"></center>
<span id="rzqkk"></span>

<rt id="rzqkk"><noframes id="rzqkk">
    <rt id="rzqkk"><noframes id="rzqkk">
  • <span id="rzqkk"></span>