Display Numeric Keypad for HTML input box

Tablets and mobile user always expect numeric keypad by default for number text box entry. HTML5 have introduced two text type named “tel” and “number”. All modern browsers supports this new type. Both “tel” and “number” will bring default numeric keypad for tablels like ipad/andoid tab.

<input type=”tel” class=”someclass”/ >
<input type=”number” class=”someclass”/ >

The basic difference between “tel” and “number” is that “tel” type does not allow decimal number, is useful for only telephone number entry.

One problem I have found when I have used this new type in jqery modal. Modal by default setfocus first text and if we use first textbox “tel” or “number” type, ipad does not show numeric keypad.
I do not find any good solution for this. Alternatively we can change default foucs of jqueryui modal to button instead of text box.

open: function(event, ui) {
        $(":button:contains('Submit')").focus(); // 'Submit' is the button text

Javascript string to integer conversion hell

Javascript is great. But some over intelligency cause also great problem to the developer.

Here I give some string to integer conversion result in JavaScript,

1.  parseInt(“01”)=>1

2.  parseInt(“05”)=>5

3.  parseInt(“08”)=>0

4.  parseInt(“09”)=>0


Here javascript is giving wrong result for 3 and 4.


When javascript get Zero leading string as parseInt parameter, it takes 8 base system for conversion automatically instead of 10 base.


Simply set the base explicitly like below,

3. parseInt(“08”,10)=>8

4. parseInt(“09”,10)=>9

It is best practice in javascript to set the conversion “base” during any type number parsing.