Skip to content Skip to sidebar Skip to footer

Is It Legal To Set An Input With Type=number To Be Blank

Lets say I have would this code be legal: $('#inpID').val(''); and does it work in practice in differ

Solution 1:

Taken from here: http://www.w3.org/TR/html5/forms.html#number-state-(type=number)

If the element is mutable, the user agent should allow the user to change the number represented by its value, as obtained from applying the rules for parsing floating-point number values to it. User agents must not allow the user to set the value to a non-empty string that is not a valid floating-point number.

My read on that is that yes, it is okay to use an empty string.

Post a Comment for "Is It Legal To Set An Input With Type=number To Be Blank"