开发者

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.


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


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


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

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜