Press a key inside the <input> element to hide it. - Javascript jQuery

Javascript examples for jQuery:Key Event

Description

Press a key inside the <input> element to hide it.

Demo Code

ResultView the demo in separate window

<!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>

Related Tutorials