javascript - Validating numeric value in text field does not give desired result -
validating text field value may positive whole number or number 1 decimal point , 1 decimal after point in javascript: 123 1 12345 233.2 1212.2 1.1 are valid numbers , 1.222 1.33 -89789 -3 are invalid numbers. ihave applied not desired result function checkonedecimal(txtbox) { if (txtbox.value.length > 0) { if (isnan(txtbox.value)) { txtbox.value = ""; alert("please enter number 1 decimal places"); txtbox.focus(); return; } else if (parsefloat(txtbox.value) > 0) { txtbox.value = ""; alert("please enter number 1 decimal places. eg. 8.1"); txtbox.focus(); return; } var oregexp = /^\s*\d+\.\d{1}\s*$/; if (oregexp.te...