Jquery to limit the range of input
- by Sharvari
I have a text box that takes input as amount..I want to prevent the user from entering Amount greater than a certain amount..I tried using ajax ..but its not working the way i want..I think jquery wud do the needful..but I am not so good at it..If any one can help??
Ajax function that i Have written:
function maxIssue(max, input, iid) {
var req = getXMLHTTP();
var strURL = "limit_input.php?max=" + max + "&iid=" + iid;
if (input > max) {
alert("Issue Failed.Quantity Present in Stock is " + max);
}
if (input < 0) {
alert("Issue Failed.Enter positive Value");
}
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
document.getElementById('maxdiv').innerHTML = req.responseText;
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
}
}
req.open("GET", strURL, true);
req.send(null);
}