首页javascripttextareaJavascript Form - 如何TextArea的句柄键按下事件

Javascript Form - 如何TextArea的句柄键按下事件

我们想知道如何TextArea的句柄键按下事件。


<html>
    <head>
    <script>
    function showDialog(){
      console.log("A key was pressed down");
    }
    </script>
</head>
<body>
    <form name="myForm">
      <textarea name="myTextArea" rows=2 cols=50 onKeyDown='showDialog()'>
      Here is some text in my text area.
      </textarea>
    </form>
</body>
</html>