Instantly get value while you type with jQuery

Many questions have been asked, how do i get that input value to be shown on another DIV box or somewhere while i typing in the form>

luckily jQuery has a easy solutions for us.

lets say we have a form that included a text input, and a label input

[cc lang=”html”]


Here is the jQuery code that allow get the text while you type to be shown on the label instantly.

$(function(){
// while you are typing using keypress event
$('input').bind('keypress',function(){
// get the value of the input
var inputValue = $(this).val();
//insert the value to label
$('label').text(inputValue);
})
})

easy har? enjoy.