Reputation: 2709
I will show you Fiddle link about my program question.
<label for="test">Username:</label>
<input type="text" id="test">
<p id=""></p>
$("#test").onclick(function(){
alert('xx');
})
I want to realize this function:
p
tag real-time displays input
tag's content when I input something. I'll be very happy if you answer me.
Thank you.
Upvotes: 0
Views: 60
Reputation: 1086
You can attach it to the keyup event that way it updates with every keystroke.
Try this http://jsfiddle.net/Z2Xwr/1/
$("#test").keyup(function(){
$('#paragraph').html($(this).val());
})
Upvotes: 1
Reputation: 26431
You can use keyup
event,
$("#test").keyup(function(){
$("#para").html(this.value) ;
});
Upvotes: 1