Skip to content Skip to sidebar Skip to footer

Javascript Help - Prevent Duplicate Characters In Textbox

Looking for a bit of help to modify some already-working JavaScript. I am using a piece of JavaScript along with a filtered textbox, the filtered text box only allows {1234567890,-

Solution 1:

if(evt.srcElement.value.indexOf(".") > -1) {
    if (charCode === 46) {
        return false;
    }
}
if(evt.srcElement.value.indexOf("-") > -1) {
    if (charCode === 45) {
        return false;
    }
}
return true;

Post a Comment for "Javascript Help - Prevent Duplicate Characters In Textbox"