JSFiddle - React, Tailwind, and code Playground
by Shishir Max
HTML
<center>
<p id="p1">
Language:
<select id="Language">
<option>Select</option>
<option id="English" value="www.google.com">English</option>
<option id="Marathi" value="www.yahoo.com">Marathi</option>
</select>
</p>
<input type="submit" id="button" value="Open" onclick="OptionSelect()">
</center>
JavaScript
function OptionSelect(){
var s1 = document.getElementById("Language");
var s2 = s1.options[s1.selectedIndex].value;
//console.log(s1.selectedIndex);
console.log(s2);
if(s1.selectedIndex == 1){
console.log("English");
//console.log(s2);
window.location.href = s2;
}
else if(s1.selectedIndex == 2){
console.log("Marathi");
//console.log(s2);
window.location.href = s2;
}
else{
alert("Option Wrong");
}
}