JSFiddle - React, Tailwind, and code Playground

by Serge

HTML

<select id="sel" onchange="test(this.value)"><option>option1</option></select>

JavaScript

s=document.getElementById("sel");
var opt = document.createElement('option');
opt.value = "add";
opt.innerHTML = "Add New Option";
s.appendChild(opt);

function test(val){
    if (val = "add"){
        alert("test");
    }
}