![]() |
Definition and UsageThe Onblur is most often used with form validation code (e.g. when the user leaves a form field). Tip: The Applies toThe
Browser Support |
Example:
HTML
Enter your name: <input type="text" name="fname" id="fname" onblur="myFunction()">
<p>When you leave the input field, a function is triggered which transforms the input text to upper case.</p>
<script>
function myFunction() {
let x = document.getElementById("fname");
x.value = x.value.toUpperCase();
}
</script>
html onblur attribute |
How to Validate an input field when the user leaves it | HTML Attribute |
Read Full: | HTML Attribute |
Type: | Develop |
Category: | Web Tutorial |
Sub Category: | HTML Attribute |
Uploaded by: | Admin |
Views: | 96 |
Reffered: https://www.w3schools.com/tags/att_onblur.asp