i need to verify that my text box should contain only- numbers,-,/,.
i have written fallowing function but it’s not working..
<input type="text" onkeyup="isValidDate(this);"/>
function isValidDate(f){
var regDate = '/^[0-9]*|\/*\|-*|.*$/';
alert("called::"+f.value);
if(!regDate.test(f.value))
alert("inside");
f.value = f.value.replace(regDate,"");
}
i am getting an error that-regDate.test is not a function
am i doing something wrong?
Title says you’re trying to match date format but your question text says that:
You can try this regular expression: