I use the following function for decimal validation it was work fine in IE and Chrome not in FF.Backspace and delete key working in IE and Chrome.Not in FireFox
$('.decimalValidate').live('keypress', function (e) {
var decimalid = $(this).attr("id");
var decimalval = $('#' + decimalid).val();
var decimalvalidate = ApplyDecimalFilter(decimalval, e);
if (decimalvalidate == false) return false;
});
function ApplyDecimalFilter(id, event)
{
try {
return NewDecimalFilter(id, event);
} catch (e) {
alert(e.message);
}
}
function NewDecimalFilter(o, event) {
if (event.which > 47 && event.which < 58) {
return true;
}
if (event.which == 50 ||(event.which == 8 || event.which == 46) && o.indexOf('.') == -1) {
return true;
}
return false;
}
this if condition not working in FireFox only.this is used to enter the only one dot symbol
if (event.which == 50 ||(event.which == 8 || event.which == 46) && o.indexOf('.') == -1) {
return true;
}