Someone helped me create a jquery contact form, with field validation. There is a phone number field. The field allows for only numbers. We need the field to also contain a few other common "phone" character... such as ()-. and space. Can someone help me modify the code below ...
// only numberic value validation
    $( ".only_numberic" ).keypress(function(event){
        var inputValue = window.event ? event.keyCode : event.which;
        // allow letters and whitespaces only.
        if(    !( inputValue >= 48 && inputValue <= 57) && (inputValue != 0 && inputValue != 8 && inputValue != 9 ) ) {  
            event.preventDefault(); 
        }
    });
Note: I don't mind that the class is still "only_numberic" (that's only a name) ... just need the validation fixed.
FINAL FIX
Below is the final fix that works.
// only numberic value validation
$( ".only_numberic" ).keypress(function(event){
    var inputValue = window.event ? event.keyCode : event.which;
    // allow letters and whitespaces only, and () and - and period[.] and (space).
    if(    !( inputValue >= 48 && inputValue <= 57) && (inputValue != 0 && inputValue != 8 && inputValue != 9 && inputValue!=40 && inputValue!=41 && inputValue!=45 && inputValue!=46 && inputValue!=32) ) {  
        event.preventDefault(); 
    }
});
 
    