Possible Duplicate:
disable textbox using jquery?
How to prevent changing a textbox value using jquery in document.getElementsByName().
There is an option like this.
document.getElementById("Quantity").defaultValue;
Is there any option to stop my textbox's value from changing in document.getElementsByName().
After my alert, I want to make the value of textbox stay the same when the condition is not matched.
My code:
 $(function () {
            $('input[name=Quantity]').blur(allownumbers);
        });
        function allownumbers() {
            var elements = document.getElementsByName('Quantity');
            for (var i = 0; i < elements.length; i++) {
                if (elements[i].value == '' || elements[i].value < 1) {
                    alert('Please enter a valid value');
                    return false;
                }
                else if (elements[i].value > 100) {
                    alert('There is no enough inventory for this product to fulfill your order');
                    return false;
                }
            }
            return true;
        }
  <input id="Quantity" type="text" name="Quantity"/>
Any suggestions.
EDIT : I tried using this code.
$("#textbox1").removeAttr("disabled"); 
If I enter 200. The alert appears and the textbox becomes disabled and so I cant even re-enter the correct value in textbox. How to bring back the defaultvalue of my textbox. ?
 
     
     
    