Add A Placeholder To A Number Input

Posted by Weston Ganger

I needed to add a placeholder to a number input. Apparently this is only supported in Chrome.


The solution I found was to start with a text input with a placeholder and then on focus change it to a number.


<input placeholder="Amount" onfocus="this.type = 'number';">

So it will now have a placeholder until the input comes into focus.


Related External Links:

Article Topic:Software Development - HTML / CSS

Date:April 07, 2016

Recommended Posts