VOOZH about

URL: https://www.geeksforgeeks.org/angular-js/angularjs-ng-blur-directive/

⇱ AngularJS ng-blur Directive - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

AngularJS ng-blur Directive

Last Updated : 11 Jul, 2025

The ng-blur Directive in AngularJS is fired when an HTML element loses their focus. It doesn't override with element's original onblur event i.e. both the ng-blur expression and original onblur event will execute. 

Syntax:

<element ng-blur="expression"> 
 Contents... 
</element>

Parameter:

  • expression: It refers to the variable or the expression to be evaluated. 

Note: The ng-blur directive is supported by <input>, <a>, <select> and <textarea>

Example 1: This example displays the text message "Enter your text here" when the input is focused and hides it when the input focus loses. 

Output:

👁 Image
 

Example 2: This example counts the number of times focus is removed from the textarea. 

Output:

👁 Image
 
Comment

Explore