I use the following function for decimal validation.the textbox only allow to enter numbers and .(dot) symbol only.It was working fine in IE and Chrome.My problem is I get <
In firefox, event
isn't global. window.event
is undefined
. You need to pass the event as a parameter. And by the way, you should use .on
instead of .live
if you use jQuery >= 1.7.
$('.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);
}
}
The live demo.