How do I keep existing values from shifting to the right when entering keypresses into a jQuery Mask

Posted by Andrew on Stack Overflow See other posts from Stack Overflow or by Andrew
Published on 2010-04-01T14:51:13Z Indexed on 2010/04/01 14:53 UTC
Read the original article Hit count: 352

Filed under:
|
|
|
|

I have a text box I'm using as a timer display "hh:mm:ss" When I select the box and press a number, it inserts the number at the cursor location, but instead of replacing the value at that position, it shifts all existing values over. For example, the timer text box reads "01:00:35" and I replace the first minute position with 1, the timer text box will then read "01:10:03."

Anybody know how to force the text box to replace, instead of insert, at the cursor position?

I've tried intercepting onKeyPress, doing the replace manually, rewriting the entire timer text, and then returning false. But, that doesn't worked with a jQuery masked input, because my function runs first.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about masked