Default option "Other..." on a datalist, can you remove it?

Asked

Viewed 17 times

0

Good morning!

<datalist id="datalist">
     <option value="08:00"></option>
     <option value="08:30"></option> 
     <option value="09:00"></option> 
</datalist>

<input list="datalist" class="form-control" type="time">

Following this code has occurred what I wish except for one thing, it adds an option by default "Other..." and I don’t want it to stay there... And I just can’t get it out, I tried to create this option with an id and try to remove it with javascript, but I couldn’t for anything... Does anyone know if you can take ?

inserir a descrição da imagem aqui

  • If you need a non-exclusive list, why not use one <select> then?

  • Because I’m manipulating this list a lot with javascript and I found it much easier to do this with datalist, but in case you don’t have the option "Other." I’ll have to redo a part of my code to be with a select.

  • From what I see, both the input[type=time] as to the datalist, the behavior will vary from browser to browser. So maybe the solution is to use the good old select.

  • 1

    I’m finding that too, thanks for your help!

No answers

Browser other questions tagged

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