Hi,
I'm trying to only allow limited characters to be entered into a textbox using a regex I have the correct expression but cannot seem to get it to work?
HTML Code:<script language="javascript" type="text/javascript"> function myNumberFilter(txb) { var filter = new RegExp("-{0,1}[0-9 \,]*"); if (!filter.test(txb.value)) txb.length -= 1; } </script> <form> <input type="text" id="test" onKeyUp="myNumberFilter(this);" /> </form>



Reply With Quote

Bookmarks