Sử dụng onblur thuộc tính thực thi một tập lệnh khi phần tử mất tiêu điểm trong HTML. Bạn có thể thử chạy mã sau để triển khai onblur thuộc tính -
Ví dụ
<!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>