So I have have input in javascript put I cant figure out how to only use numeric input, I tried using the numeric type put it only worked if I starded with letters, but when I start with numbers and then add letters, then it leaves the letter in the inputfield, so my container for the input is:
var td = document.createElement("td");
var input = document.createElement("input");
input.type = "number";
input.name = "//retseptid/retsept[" + count + "]/doos";
input.id = "prescription_" + count + "_dosage";
input.value = UTF8Decode(prescription.doos);
input.className = "txt_left";
input.style.width = "52px";
if(prescriptionContainerIsDisabled) {
input.disabled = true;
}
else {
addChangeListener(input);
}
td.appendChild(input);
td.appendChild(document.createTextNode(" "));
I think, that I cant use onkeypress
here is the outcome, and the field that has to let only numbers to be inputed