After doing a lot of Google searching I have found lot's of folks with the same problem I am running into, but no solutions. I am using Phonegap to build an Android app. I have an input field with type set to number (this allows the numeric keyboard to pop up). If I enter 0.1 life is good. If I type .1 into the input box I get a blank field returned. I tried this bit of code, which works on the web version, but not on the app to try and fix the problem:
$('#merchantInput input[type=number]').on('blur',function(){
var input_regex = new RegExp(/^\.{1}\d+/);
var test = input_regex.exec($(this).val());
if(test != null){
new_num = '0' + $(this).val();
parseFloat($(this).val(new_num)).toFixed(2);
}
});
Still, nothing. Any idea's of how to fix this issue?
Just tried this too:
$('#merchantInput input[type=number]').on('blur',function(){
var new_num = parseFloat(($(this).val() * 10) / 10).toFixed(2);
$(this).val(new_num);
});
I am closer....when you enter .3 I get 0.00.