How do I grab the value from an input box as its being entered?
I noticed you used the "jquery" tag. For jQuery, you can use the .keypress() method.
From the API documentation:
Description: Bind an event handler to the "keypress" JavaScript event, or trigger that event on an element.
The event will fire every time keyboard input is registered by the browser.
.keydown()
and .keyup()
are also available. Their behavior is slightly different from .keypress()
and is outlined by the API documentation as well.
The nice thing about jQuery is that you can use the same code across Firefox, IE, Safari, Opera and Chrome.