Alex Schneider
Alex Schneider

Reputation: 355

html select with custom user defined option

i would like to create an html select element that a user may use to select his favorite something OR in case that his favorite is not in the list there is also a select option "define your own" and if you click it the select turns into a text input.

Mayhaps there is a jquery plugin/solution for that?

Upvotes: 0

Views: 298

Answers (1)

barakadam
barakadam

Reputation: 2249

Create your select list in HTML. Create your input in HTML. Hide the input with CSS display:none. Then use jQuery (don't forget to include jquery library at beggining of page) .change() function to check if your item gets selected. When it is selected just do : $("#selectlist").hide(); $("#inputfield").show();

Upvotes: 1

Related Questions