Add input button to select

Asked

Viewed 1,301 times

2

I want a button to call another page inside a select. The problem is that using this code, the button is always outside the select.

<select>
  <option>teste</option>
  <option><input type=button value="Teste2"/></option>
</select>  

Example: http://jsfiddle.net/r82v3vxn/

  • By a button inside a select you can’t... You can manipulate the select option with css to be identical to a button

  • 1

    "Identical" I don’t know, but similar is really possible. I think that your suggestion would give an answer, @Cesarmiguel ;)

2 answers

3

The elements <option> do not accept HTML, only text. If you want to create a dropdown with visually more sophisticated options, you will need to simulate your own <select> using other HTML elements, plus Javascript.

Maybe this jQuery plugin will solve it for you: http://pioul.fr/jquery-simpleselect

0

It is not possible to add one<button> inside a select natively. You get this result with javascript simulating a select.

Browser other questions tagged

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