JSFiddle - React, Tailwind, and code Playground
by taylorbuley
HTML
<html>
<script>
function place(f) {
if (f.favplace[0].selected) {
alert("Favourite place is Pune");
} else if(f.favplace[1].selected) {
alert("Favourite Place is NewYork");
} else if(f.favplace[2].selected) {
alert("Favourite place is Paris");
} else {
alert("No favorite place given.");
}
}
</script>
</html>
<form>
My favorite color:
<select name="favplace">
<option>Pune
<option>NewYork
<option>Paris
</select>
<p> <input type="button" value="Fav Place" onclick="place(this.form)">
</form>