Layout Options

  • Fixed Header
    Makes the header top fixed, always visible!
  • Fixed Sidebar
    Makes the sidebar left fixed, always visible!
Introduction
Webconcept

Description

The focus event occurs when an element gets focus (when selected by a mouse click or by "tab-navigating" to it)

The .focus() method triggers the focus event, or specifies a function to run when a focus event occurs.


Trigger the Event

Trigger the focus event for the selected elements.

v1.0

This method has the form:

.focus()

Return Value

This form returns a jQuery object.


Bind a Function to the Event

Specifies a function to run when the focus event occurs for the selected element.

v1.0

This method has the alternate form:

.focus(function)
Parameter Description
function (optional) Specifies the function to run when the focus event occurs

Return Value

This form returns a jQuery object.


v1.4.3

This method has the alternate form:

.focus(data,function)
Parameter Description
data (optional) Specifies additional data to pass along to the function
function (optional) Specifies the function to run when the focus event occurs

Return Value

This form returns a jQuery object.

Examples

Change background color of an input field when it gets focus:

$("input").focus(function(){
  $("input").css("background-color","#FFFFCC");
});

Description

The focusin event occurs when an element gets focus (when selected by a mouse click or by "tab-navigating" to it)

The .focusin() method specifies a function to run when a focusin event occurs on any child element of the selected element.

Unlike the focus() method, the focusin() method triggers if any child element gets focus.


v1.4

This method has the form:

.focusin(function())
Parameter Description
function() (required) Specifies the function to run when the focusin event occurs.

Return Value

This form returns a jQuery object.


v1.4.3

This method has the alternate form:

.focusin(data,function())
Parameter Description
data (optional) Specifies additional data to pass along to the function
function() (required) Specifies the function to run when the focusin event occurs.

Return Value

This form returns a jQuery object.

Examples

Change background color of an input field when the div element (or any child elements of it) gets focus:

$("div").focusin(function(){
  $(this).css("background-color","#FFFFCC");
	});;

Description

The focusout event occurs when an element loses focus.

The .focusout() method specifies a function to run when a focusout event occurs on any child element of the selected element.

Unlike the blur() method, the focusout() method triggers if any child element loses focus.


v1.4

This method has the form:

.focusout(function)
Parameter Description
function (optional) Specifies the function to run when the focusout event occurs

Return Value

This form returns a jQuery object.


v1.4.3

This method has the alternate form:

.focusout(data,function)
Parameter Description
data (optional) Specifies additional data to pass along to the function
function (optional) Specifies the function to run when the focusout event occurs

Return Value

This form returns a jQuery object.

Examples

Change background color of an input field when the div element (or any child elements of it) loses focus:

$("div").focusout(function(){
  $("this").css("background-color","#FFFFFF");
});