Remove Focus From textbox using JavaScript
In this tutorial, I will explain how to remove focus from textbox using jQuery. In JavaScript, There is a blur property which is used to remove the focus
Description
In previous articles, I explained How To Disable Submit Button After Click Using JavaScript, Get Latitude and Longitude from Zip Code using JavaScript, What is Local Storage and Session Storage and many more articles relating to Angular, Node, React & jQuery . Now I will explain how to remove focus from textbox using JavaScript
Use The Code:
<script type="text/javascript"> document.getElementById("txtEmail").blur(); </script>
If you want to complete code, you need to write the code like as shown below
<html> <head> <title>Remove focus from textbox using JavaScript </title> <script type="text/javascript"> document.getElementById("txtEmail").blur(); </script> </head> <body> <input type="text" class="form-control" id="txtEmail" value="" placeholder="Enter Email Address" /> </body> </html>
For your referance Link