Can multiple str.removes be used onkeyup

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kevin McGrath
    New Member
    • Jul 2012
    • 1

    #1

    Can multiple str.removes be used onkeyup

    User enters 15.666.0
    I want to first remove all dots (156660)
    The delete the first and the last number (5666)

    Code:
    <html>
    
    <title>Remove dot from textbox on input</>
    <head>
    <script type="text/javascript">
    
    function preventDot(id) {
    str = document.getElementById(id).value;     
    document.getElementById(id).value = (str.replace(".",""));   
    } 
    </script>
    </head>
    
    <body>
    <input type="text" id="input" onkeyup="preventDot(this.id)" /> 
    </body>
    </html>
    Last edited by Dormilich; Jul 9 '12, 05:27 AM. Reason: Please use [CODE] [/CODE] tags when posting code.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    and what’s the problem?

    Comment

    Working...