JSFiddle - React, Tailwind, and code Playground

by lechlukasz

HTML

Choose site:
<div id="choice">
    <a href="Masters/Degree-in-Criminal-Justice">Masters</a>
    <a href="Bachelors/Degree-in-Criminal-Justice">Bachelors</a>
    <a href="Associates/Degree-in-Criminal-Justice">Associates</a>
</div>

JavaScript

var choice = $("#choice")
  var choices = {}
  var select = $('<select>')
  select.append($('<option>'))
  choice.find('a').each(function(i,el){
      var text = $(el).text()
      choices[text] = el.href
      select.append($('<option>').val(text).html(text))
  })
  choice.empty()
  choice.append(select)
  select.change(function(val){
    var selectedValue = select.find('option:selected')[0].value
    if (selectedValue)
        alert("Redirect to: "+choices[selectedValue])
  })