I like to have an input with maximum 3 characters. In Firefox everything works fine I can only write 3 numbers inside the input - but in safari you can write a lot of number
I used something very similar to @Jules answer except his won't allow the use of keys like shift+home. Since we're validating numbers I just used isNaN in the keyup function.
$("#myField").keyup(function() {
var e = $("#myField");
if(isNaN(e.val())){
e.val(e.val().match(/[0-9]*/));
}
});