Doubt about select in html

Asked

Viewed 51 times

0

it is possible to type in a select as it occurs in programs like access or libre office base?

I am mounting a form where the field will be initially consulted, but in case of need of new options of records wanted to make available this option for manual insertion. Someone give me a light?

  • 1

    The tag itself select does not have this option, you have to emulate something similar, using input and consequently, after insertion of text, open a div below with the search result. It would look something like this component of Angular Material ??.

  • Thank you Douglas

1 answer

0

Good afternoon Sergio, I could not understand 100% what you are trying to do, but an idea would be to use a button for the user to click if he does not find your option, which would show an input field, follow an example:

HTML

<select name="something" id="">
  <option value="a">a</option>
  <option value="b">b</option>
</select>

<button>Não achei a opção</button>

<input type="text" placeholder="Digite aqui" />

CSS

input {
    display: none;
}

Javascript

$('button').click(function() {
  $('select').fadeOut();
  $('input').fadeIn();
});

And here in case you want to see it live: http://codepen.io/leofontes/pen/RoGeOr

I hope I’ve helped, it’s an option, surely there are numerous possible ideas.

  • 1

    Thank you leofontes,

  • @Sergio managed to understand Codepen? I think it was very clear but it is an idea of treatment.

Browser other questions tagged

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