
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Execute a Script When the Element Loses Focus in HTML
Use the onblur attribute execute a script when the element loses focus in HTML. You can try to run the following code to implement onblur attribute −
Example
<!DOCTYPE html> <html> <body> <p>Type text below!</p> Country: <input type = "text" name = "myid" id = "myid" onblur = "display()"> <script> function display() { var str = document.getElementById("myid"); str.value = str.value.toUpperCase(); } </script> </body> </html>
Advertisements