Get the value of input text when enter key pressed

前端 未结 6 1348
温柔的废话
温柔的废话 2020-12-13 00:04

I am trying this:




        
6条回答
  •  北荒
    北荒 (楼主)
    2020-12-13 00:35

    Listen the change event.

    document.querySelector("input")
      .addEventListener('change', (e) => {
        console.log(e.currentTarget.value);
     });
    

提交回复
热议问题