desainer website di surabaya

Restricted input type for number only by using HTML5

Best Webdesign - html5 - input type for allowing number only

tutorial from Best Webdesign to use HTML5 for allowing number only in input type

Restricted input type for number only by using HTML5

How to make the input type to be valid for number only? We do not need to use javascript, because we can do that easily with HTML5.

Let say we want to make an input type for temperature with the following rule: minimum 30o and maximum 50o, but allowing to input one decimal digit.
The example is 30.1o.

To do that we can make HTML code like below:

<input id="temperature" class="form-control" max="50" maxlength="4" min="30" name="temperature" size="50" step="0.1" type="number" />

type="number" is used to make the input type is valid for number only.
step="0.1" is used when clicking on up/down button.
min="30" max="50" is the minimum and maximum number so the form can be submitted.

The result of the example above is like below:


Good luck.

Related Article

Web Design Services - Best Webdesign - Best SEO Services

Looking for birthday with PHP and MySQL

We often experience difficulty to find the birthday between two dates inside MySQL database. It is caused by the storage we use in MySQL, namely brith date format like Y-m-d, for example 2000-12-21. The problem occurs when we try to find the birthda ...

Making an input type for checking valid email address in HTML

As a web design services, we often use input type="text" and input type="password" like below: For text: <input type="text" name="username" size="25" maxsize="15"> For password: <input type="password" name="password"> The syntax above ...

Getting current total and previous one from MySQL

As the part of the Best Webdesign, we ever get the request from our customer to show the total selling in a month including previous selling to count the percentage of profit.. To do that, we often use a very simple way, namely using two queris of M ...


Responsive web is special program code, so the website can be read in all devices. It is very suitable for better page rank in search engine like google

graphic design in indonesia

Website Design in Indonesia

Graphic Design in Indonesia


+628113638531 / +628113865464

Webdesigner in Indonesia

Videographer in Bali


Tatamedia Solusindo Surabaya

Dekkophotography Bali

Fine Art Photography in Bali

Web Design


Send your request to