keypress validation

keypress validation

Hi Guys + Girls

I have an input box which I would only like numeric values, a single decimal point, and the ability to use the backspace key. I currently have the following

$("input[id^=yourPrice]").keypress(function(event) {
if (event.which && (event.which < 46 || event.which > 57 || event.which == 47))
{
event.preventDefault();
}
});

This restricts the input box to numerical values and decimal points but I can work out how to allow the backspace functionality or how to restrict it to only a single decimal point.

Can anybody point me in the right direction