NewDLR Posted April 12, 2015 Share Posted April 12, 2015 Hi, I want to restrict the field to 3 spaces for a "number" input like this <input type="number" name="10" min="0" step="1" max="45" size ="3"> It works with type="text", but I cannot seem to get it to work for type="number" Is there a solution to this? Many thanks Quote Link to comment Share on other sites More sharing options...
maxxd Posted April 12, 2015 Share Posted April 12, 2015 If you're setting a max of 45, the field is only going to have at most 2 digits in it. Why try to allow 3 when 2 is going to happen? If you're worried about browsers that don't support a number form field, add that check to your javascript validation when the form is submitted. Quote Link to comment Share on other sites More sharing options...
requinix Posted April 13, 2015 Share Posted April 13, 2015 size isn't valid on number inputs. Use CSS instead. Quote Link to comment Share on other sites More sharing options...
maxxd Posted April 13, 2015 Share Posted April 13, 2015 Dang - I got size and maxlength confused. NewDLR, if you're trying to set the width of the field, do as requinix suggested and use CSS. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.