0

I am trying to show images in Dropdown options in Backbone template. Each option will have image in it. I have tried different ways of doing this but couldn't succeed. Can anyone let me know correct way of doing this.

Here is code i am trying:

         <div class="optionWrapper">
            <select id="<%= id %>" class="extra_option">
              <% _.each(options, function (opt) { %>
                <option value="1" <img src="<? echo $uploads;?>option_thumbnails/<%= opt.thumbnail_file %>">></option> 
              <% }); %>                      
            </select>
         </div>
Mohsin Rafi
  • 539
  • 6
  • 14
  • You need to use custom select for this task. With native implementation of select tag it's not a good idea to use `` tag inside of select options. [Here](http://stackoverflow.com/questions/2965971/how-to-add-a-images-in-select-list) a few workarounds. – vvahans Dec 05 '14 at 19:23
  • Yes, and one more thing. Your `each` block should be in select tag. – vvahans Dec 05 '14 at 19:24
  • I think its not possible, as ` – Mohsin Rafi Dec 08 '14 at 06:43
  • Since i didn't find any solution so what i did is i made **
  • ** of option images and put this **
      ** in Bootstrap **Collapse**. In this way i achieved above drop down functionality.
  • – Mohsin Rafi Dec 23 '14 at 12:55