JSFiddle - React, Tailwind, and code Playground
HTML
<ul id="test">
<li><a href="http://www.yahoo.com">yahoo</a></li>
<li><a href="http://www.google.com">Google</a></li>
</ul>
JavaScript
$(function() {
$('#test').each(function() {
var select = $('<select/>').insertBefore($(this).hide());
var option = '';
$('>li a', this).each(function() {
// check if current location is the same as the href of the link being processed...
var selected = (window.location.href == this.href)?'selected="selected"':'';
// build the options...
option += '<option value="' + this.href + ' ' + selected + '">' + $(this).html() + '</option>';
});
select.html(option).change(function() {
//alert('url = ' + this.value );
window.location.href = this.value;
})
});
})