HTML Form How to - Show hide input with hover event








Question

We would like to know how to show hide input with hover event.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
div:hover input {<!--from   ww w .  j  a va  2 s.  c o m-->
  display: block;
}

input:focus {
  display: block;
}

input {
  display: none;
}
</style>
</head>
<body>
  <div>
    Text <input type="text" />
  </div>
</body>
</html>

The code above is rendered as follows: