DEV Community

IRAWAN
IRAWAN

Posted on

Answer: How to set the max value and min value of <input> in html5 by javascript or jquery? [closed]

jQuery makes it easy to set any attributes for an element - just use the .attr() method:

$(document).ready(function() {
    $("input").attr({
       "max" : 10,        // substitute your own
       "min" : 2          // values (or variables) here
    });
});

The document ready handler is not required if your script block appears…

Top comments (0)