ASP.NET C# Beginners Guide :JavaScript Function onblur() and onfocus() - Example
Introduction
In this Article, I describe how to use the JavaScript function on blur() and on focus() in Asp.net C# application using a simple example
Here is the Explanation Step by Step:
Steps
Step 1
Just drag one simple textbox from toolbox and just add attributes like the below screen shot.
Step 2
Then as we know, just write the required functions inside the Script tag like below:
http://csharpcorner.mindcrackerinc.netdna-cdn.com/UploadFile/BlogImages/06072016133114PM/Script.jpg
That's it, now this function will be triggered inthe client side and you will get the Output like the below screen shot
Outputs
Output 1
While Cursor is on the Bill no,
Note
Changed to the Yellow Color since we have provided the color as "Yellow" in the myFocusFuction() in the above JavaScript code.
Output 2
Once it came out of the Bill No.
Note
Back to the Normal Color since we didn't provide any color in the myBlurFuction() in the above JavaScript code.