Thanks for your reply.
After using the suggested approach, the masked textbox is getting focus but cursor is not at the required position in the masked textbox to continue typing. It is always shifted to the start position.
This function is written on KeyUp event. If existing value in textbox is 25. Then 7 is entered between 2 and 5, then new value would be 275 and cursor should be after 7 but it is not the case. Is there a way to get the current cursor position and use that to set it after changing mask.
Similarly, if cursor is at end and we pressed back arrow then cursor should keep its new position which is just left of 5.
Or, if selected text is used from keyboard to copy or paste.
How to bring cursor at required position of text typed in the masked text box ?
When i use txtPostal.get_caretPosition() , it says object doesn't support this property. I am using IE7.