How to make the suggested <datalist> data appear only when typed?

Asked

Viewed 43 times

1

<!DOCTYPE html>
<html lang="pt-br">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Example</title>
  <style>



  </style>
</head>
<body>

  <form action="">
    <label for="myFruit">What's your favorite fruit?</label>
    <input type="text" name="myFruit" id="myFruit" list="mySuggestion">
    <datalist id="mySuggestion">
      <option>Apple</option>
      <option>Banana</option>
      <option>Blackberry</option>
      <option>Blueberry</option>
      <option>Lemon</option>
      <option>Lychee</option>
      <option>Peach</option>
      <option>Pear</option>
    </datalist>

    <input type="submit" value="de">
  </form>

<script>


</script>

</body>
</html>

In the above example when you click on the text box(input="text") immediately the data automatically suggested by <datalist>, but what I would like in this case would be only when the user starts typing, then yes the data appeared.

  • 2

    Something Thus?

  • 1

    Exactly what I was looking for! Now yes, thanks for the help.

  • You’re welcome, go ahead ;)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.