-1

I have a textbox which is set up to convert a number into currencies using the following line:

$("#price").live('keydown', currenciesOnly).live('blur', function () { $(this).formatCurrency(); });

In order for the textbox to convert 81 to $81.00 the following needs to happen:

  1. The HTML field before the textbox has to send the focus to the currency textbox
  2. Then the currency textbox has to lose focus to another field.

How can I make it so the currency textbox converts to currency as soon as it has a value instead of losing focus?

1
  • several different mask plugins you could use. Appears from your use of live() you are running fairly old version of jQuery so check compatibility with your version Commented Jul 20, 2014 at 3:45

1 Answer 1

1

Blur event fire only when control lose focus, use keydown event or input event instead.

You probably don’t want interrupt while user is typing, setup a timer do formatCurrentcy when no keydown for a while.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.