1

I need to add option value + a tag along with that and I need to take an action when clicking on that a tag like following.

enter image description here

enter image description here

I tried with something like following

<select>
<option value="1">Free <a> select<a></option>
<option value="1">Pro <a> buy<a></option>
<option value="1">Unlimited <a> buy<a></option>
</select>

but option value should not contains html tags so it gets removed when goes to DOM. Any idea how to make this happen?

Thamaraiselvam
  • 6,961
  • 8
  • 45
  • 71
  • Make a custom version of the select box? Or maybe just have an `onchange` that brings you to the site? – A. L Mar 20 '18 at 08:13
  • 1
    _“Any idea how to make this happen?”_ - assuming how confusing this could be to users, who expect a select field to work a certain way, I would probably say, best not at all ... Plus, it makes rather little sense IMHO to present me with an option to select, as if I was just changing some setting, when you actually want me to go and buy this first. – CBroe Mar 20 '18 at 08:32
  • @CBroe you are correct. will reconsider the design. Thanks. – Thamaraiselvam Mar 20 '18 at 08:57

1 Answers1

1

As far as I know, <option> cannot have any tags inside.

Maybe try something like this?

http://www.jankoatwarpspeed.com/wp-content/uploads/examples/reinventing-drop-down/#

If you want to redirect to a link when clicked on the option, you may use something like this:

using href links inside <option> tag

S.Dan
  • 1,826
  • 5
  • 28
  • 55