JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<head>
<script type="text/javascript">
var a = new Array();
a[0] = "";
a[1] = "kgs";
a[2] = "gms";
a[3] = "ltrs";
a[4] = "ml";
a[5] = "nos";
a[6] = "pkt";
var sup = new Array(),
sup_map_sup = new Array(),
sup_map_item = new Array();
sup[0] = "";
sup[1] = "S1";
sup[2] = "S2";
sup_map_sup['0'] = "1";
sup_map_item['0'] = "2";
sup_map_sup['1'] = "2";
sup_map_item['1'] = "3";
sup_map_sup['2'] = "2";
sup_map_item['2'] = "4";
sup_map_sup['3'] = "2";
sup_map_item['3'] = "5";
sup_map_sup['4'] = "2";
sup_map_item['4'] = "1";
function updateunit(thiss){
var b1 = thiss.value;
var c = b1.split(',');
var d = c[1];
var e = a[d];
document.getElementById('pane2').innerHTML = e ;
//document.getElementById('pane3').innerHTML = e ;
document.getElementById('supplier').length = 1;
alert(sup_map_item);
for (var i = 0; i < sup_map_item.length; i++){
if (sup_map_item[i] === c[0]) {
addOption(document.getElementById('supplier'), sup_map_sup[i], sup[sup_map_sup[i]]);
}
}
}
function addOption(selectbox, value, text ){
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}
</script>
</head>
<body>
<h1>Online POS Tool</h1>
<form action='temp.php' method="POST">
Item Name <select name ="itemname" id = "itemname" onchange = "updateunit(this)"><option value = '1,1' > A </option><option value = '2,1' > B </option><option value = '3,2' > C </option><option value = '4,3' > D </option><option value = '5,4' > E </option></select> <br>
Supplier <select name ="supplier" id = "supplier">
<option value = ""> Select an Item </option>
</select> <br>
Amount <input type="text"...