Whenever a dot '.' is typed in my input (type=number) field, I want it replaced by a comma ','.
$(box).find('input[type=number]').keypress(function(evt){
if(evt.which==46){
$(this).val($(this).val()+',');
evt.preventDefault();
}
});
The event is well fired, but instead, the field gets totally empty. What's wrong?
EDIT
The reason why I'm doing this is that Chrome (latest version), contrary to the HTML5 recommandation, use comma and discard dot in input type=number. I'm currently only developing for Chrome cause I can't test my app somewhere else for the moment. Any comment on this (abnormal ?) situation would be appreciated.