tony
tony

Reputation: 3

How to code this using javascript function?

HTML:

<label>Estimated value of property:</label><input type="text" value="" id="prop_value"/>

How to get the value of "prop_value" and display it here when typing the value:

<p>You told us the estimated value of your property is: "prop_value"</p>

Help me please.

Upvotes: 0

Views: 118

Answers (3)

mplungjan
mplungjan

Reputation: 177860

HTML

You told us the estimated value of your property is: <span id="output"></span>

Plain javascript DEMO HERE

window.onload=function() {
  document.getElementById("prop_value").onkeyup=function() {
    document.getElementById("output").innerHTML=this.value
  }
}

jQuery DEMO HERE

$('#prop_value').bind('keyup', function() {
  $("#output").text($(this).val());
})    

Upvotes: 1

2hamed
2hamed

Reputation: 9047

in jquery you can get the value of input tags this way:

$("#tagID").val();

Upvotes: 0

deepi
deepi

Reputation: 1081

using javascript you can fetch the textbox value i.e,

var val=document.getElementById("prop_value").value;

and use 'val' to show in proper location

Upvotes: 1

Related Questions