This should work. It has not been cross-browser tested:
$("#theTextBox").keyup(function() {
if($(this).val().indexOf('.') !== -1) {
var newVal = $(this).val().replace('.', '');
$(this).val(newVal);
}
});
You can try it here.
EDIT: I think this is better:
function doItPlease() {
if ($(this).val().indexOf('.') !== -1) {
var newVal = $(this).val().replace('.', '');
$(this).val(newVal);
}
}
$("#theTextBox").bind("keydown keyup", doItPlease);
Try the less sucky solution here.
EDIT (again): I favour the above solution, because I quite like the feedback aspect. That said, I think this is what you're after:
$("#theTextBox").keyup(function(e) {
if (e.which != 190) {
return true;
}
e.preventDefault();
});
Try it here.