Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <div class="test-search-wrapper">
      <input type="text" class="test-search-input" placeholder="Enter search">
      <div class="test-search-content">
        <a href="www.test.com" onclick="alert('ok')">Test link</a>
      </div>
    </div>
    <style>
      .test-search-wrapper {
        position: relative;
        width: 400px;
        margin: 0 auto;
      }
      .test-search-input {
        width: 100%;
        padding: 10px;
      }
      .test-search-content {
        padding: 10px;
        border: 1px solid red;
        visibility: hidden;
      }
      .test-search-content.visible {
        visibility: visible;
      }
    </style>
    <script>
      document.querySelector('.test-search-input').addEventListener('focusin', () => {
        document.querySelector('.test-search-content').classList.add('visible');
      });
    </script>
</body>
</html>
Output 300px

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers