0

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.

2
  • please explain more about your question.Didnt understand a thing Commented Feb 18, 2014 at 6:16
  • use onfocus or onblur.not onclick Commented Feb 18, 2014 at 6:18

2 Answers 2

1

You can use keyup event,

$("#test").keyup(function(){
         $("#para").html(this.value) ;               
 });

FIDDLE DEMO.

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

Comments

1

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());               
 })

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.