Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> JavaScript

Sự kiện onkeyup trong JavaScript là gì?

Kích hoạt khi nhả phím sau khi đã nhấn xuống.

Ví dụ: Tự động chuyển chữ thường khi gõ

<html>
  <head>
    <script>
      function toLower() {
        var el = document.getElementById("subject");
        el.value = el.value.toLowerCase();
      }
    </script>
  </head>
  <body>
    <p>Gõ chữ HOA xem tự động chuyển thường:</p>
    <input type="text" onkeyup="toLower()" id="subject">
  </body>
</html>