Get the value of input text when enter key pressed

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

I am trying this:




        
6条回答
  •  执念已碎
    2020-12-13 00:17

    Something like this (not tested, but should work)

    Pass this as parameter in Html:

    
    

    And alert the value of the parameter passed into the search function:

    function search(e){
      alert(e.value);
    }
    

提交回复
热议问题