In Javascript how do I add a new option into Html Select so inserted based on alphabetical value of text ?
So I have this
var selectMask = document.getElementById("filenamemasks");
var newmask = document.createElement("option");
newmask.text = maskName;
newmask.value = maskMask;
selectMask.add(newmask);
but I want it to add newmask so it comes just after the the option that has value of text just alphabetically before.