A
A
Artem Pavliienko2018-04-13 22:49:17
Bootstrap
Artem Pavliienko, 2018-04-13 22:49:17

How to make a list of countries with flags using bootstrap?

Hello.
I am using this plugin . But in place of elem I need to insert the name of the countries with flags, for example Example 4 . But it's a dropdown menu, and I just want a list.
It turned out something like this:

<section id="select">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div id="select_countries">
                    <select role="option" id="public-methods">
                        <option><a tabindex="-1" href="#" data-option="" data-flags="true"></a></option>
                        <option><a tabindex="-1" href="#" data-option="AF" data-flags="true"><i class="glyphicon bfh-flag-AF"></i>Afghanistan</a></option>
                        <option><a tabindex="-1" href="#" data-option="AL"><i class="glyphicon bfh-flag-AL"></i>Albania</a></option>
                   </select>
                </div>
            </div>
        </div>
    </div>
</section>

And in the browser:
<ul class="ms-list" tabindex="-1">
     <li class="ms-elem-selectable ms-selected" id="0-selectable" style="display: none;"><span style="display: none;"></span></li>
     <li class="ms-elem-selectable" id="-884569212-selectable"><span style="display: none;">Afghanistan</span></li>
</ul>

The plugin changed everything.
5ad10978ead9d828208291.jpeg
Tell me please, how can I be?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey delphinpro, 2018-04-13
@kvazarmp

With this plugin, without altering its internal logic, there is no way.
You should look at the source before asking a question. There, any html in the options is hard cut, even if they are dynamically set.
Plus, custom markup is generated according to data from the native (hidden) select. And in the native select, only text is allowed in the options, no html (here the browser itself cuts during the construction of the DOM).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question