I have the following bootstrap dropdown. Using PHP I get the country of the visitor. So if the visitor comes from England or any other country not listed below, the English must be shown, on top and be removed from the list. as shown below.
I can do the PHP side, but what about the javascript since this is not a select dropdown and there is not a selected
?
Standard version:
<li class="dropdown">
<a href="#" data-toggle="dropdown" class="dropdown-toggle">English <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="gr.html">Greek</a></li>
<li><a href="it.html">Italian</a></li>
<li><a href="cz.html">Czech</a></li>
</ul>
</li>
When a visitor from the UK comes in:
<li class="dropdown">
<a href="#" data-toggle="dropdown" class="dropdown-toggle">English <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="gr.html">Greek</a></li>
<li><a href="it.html">Italian</a></li>
<li><a href="cz.html">Czech</a></li>
</ul>
</li>
Here is what the HTML will be when a Greek enters:
<li class="dropdown">
<a href="#" data-toggle="dropdown" class="dropdown-toggle">Greek<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="en.html">English</a></li>
<li><a href="it.html">Italian</a></li>
<li><a href="cz.html">Czech</a></li>
</ul>
</li>