I'm trying to validate user input data using jquery. Here is the code I use.
$('#ole').keypress(function(event) {
if ((event.which != 46 || $(this).val().indexOf('.') != -1) && (event.which < 48 || event.which > 57)) {
event.preventDefault();
}
});
The code above allows only integers and a single dot. What I need is to allow only two integers after the dot.
How to achieve that ?