I am working on a special calculator and I want a regular expression to remove non-alpha characters and only allow 1 dot.
Here is the function I have so far:
This code works fine for allowing 0-9 to be typed, but it removes dots.Code:function stripAlphaChars(pstrSource) { var m_strOut = new String(pstrSource); m_strOut = m_strOut.replace(/[^0-9\.]/g, ''); return m_strOut; }
Can someone help out?
I need to allow 0-9 and 1 single "."
Thanks




Reply With Quote