Showing posts with label html5. Show all posts
Showing posts with label html5. Show all posts

Friday, February 15, 2013

Chrome Doesn't Allow Decimals In input type='number'

The current 'main' version of Google Chrome (24.0.1312.57 at the time of this writing) does not allow numbers with decimal points in input text boxes of type 'number'. Mozilla Firefox (18.0.2) and a few other browsers do not have this problem.

This decimal-related behavior is apparently not a flaw in Google Chrome.

Issue 44116: input type=number won't accept decimals

This issue is marked 'WontFix' and the behavior seems to be standards compliant. Included in the issue is a fix: specify the step attribute of the input. In Chrome, the default value of 'step' is '1', meaning that it only accepts integer input. If 'step' is set to 'any', the field allows decimal input.

So, to summarize:

This is bad, but works in Firefox:

<input type='number'
       name='amount' />


This is better for Chrome:

<input type='number'
       step='any'
       name='amount' />

Thursday, September 8, 2011

How to View HTML5 LocalStorage Data From a Browser

For each browser, there is a different way to view LocalStorage data. All of these are tested using the latest desktop version of each browser.

Chrome/Chromium

The ‘resources’ tab of Chrome’s Developer tools has this. Click the arrow next to ‘local storage’. I only checked Chrome, but I assume that one can view resources in Chromium using the same method.

Firefox

Firebug can do this. ‘localStorage’ can be found in the DOM tab of Firebug.

Safari

HTML5 localStorage - Part One tells me that Safari’s developer tools also give access to local storage info. I’m dumb when it comes to Macs, and forgot that you have to enable the Develop menu item(in advanced Safari preferences). Web Inspector has a Resources tab too.

Opera

Opera Dragonfly has a Storage tab. This Storage tab has a ‘Local Storage’ subtab.

Internet Explorer

I honestly could not figure how to view this info in IE. I'll update this article when/if I figure out.