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 

Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts