JSFiddle - React, Tailwind, and code Playground
by hicurin
HTML
<input type="text" id="txt" value="203"/>
<select id="revision">
</select>
<input id="btn" type="button" value="Increase" />
JavaScript
var currentIndex = 0;
function createOption(){
var select = document.getElementById("revision");
for(var i = 1; i <= 9 ; i++){
var opt = document.createElement("option");
opt.value = i;
opt.innerHTML = i;
select.appendChild(opt);
}
for(var i = 65; i <= 90; i++){
var opt = document.createElement("option");
opt.value = String.fromCharCode(i);
opt.innerHTML = String.fromCharCode(i);
select.appendChild(opt);
}
}
createOption();
document.getElementById("btn").onclick = function(){
currentIndex ++;
var txt = document.getElementById("txt");
var select = document.getElementById("revision");
var lastChar = txt.value.substr(txt.value.length - 1, 1);
var firstChar = txt.value.substr(0, 1);
select.value = select.childNodes[currentIndex].value;
txt.value = firstChar + select.childNodes[currentIndex].value + lastChar;
};