Html css

Add A Placeholder To A Number Input

Posted by Weston Ganger on April 07, 2016

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:


Posted in HTML / CSS and Tagged with html forms 


Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts