Jquery to limit the range of input
        Posted  
        
            by 
                Sharvari
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Sharvari
        
        
        
        Published on 2012-12-18T04:27:04Z
        Indexed on 
            2012/12/18
            5:03 UTC
        
        
        Read the original article
        Hit count: 141
        
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);
}
© Stack Overflow or respective owner