Javatpoint Logo
Javatpoint Logo

AngularJS ng-focus Directive

The AngularJS ng-focus directive specifies the custom behavior on focus event. It tells AngularJS what to do when an HTML element gets focus. It doesn't override the element's original onfocus event, both will be executed.

It is supported by HTML elements like < a >, < input >, < select >, < textarea >, and the window object.

Syntax:

Parameter explanation:

expression: It specifies an expression that is executed when an element gets focus.

Let's take an example to demonstrate ng-focus directive.

See this example:

Test it Now



Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA