Javascript examples for jQuery:Key Event
Press a key inside the <input> element to hide it.
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("input").keypress(function(){ $(this).hide();//from w w w .j a v a 2s. com }); }); </script> </head> <body> <input type="text" value="Press any key inside me to hide me" size="40"> </body> </html>