Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
change automatic text lable According to change differnt text textbox in javascript

example
VB
if text textbox 1 text lable a
if text textbox 2 text lable b ..
Posted
Updated 30-Apr-14 10:47am
v3

1 solution

You can use onChange even on the textbox and use jQuery change label text.

On the other hand, if you want to do it more nicely knockout, angularJS kind of frameworks offer you two way bindings[^].


XML
<!DOCTYPE HTML>
<html>
<body>

<label id="label" for="inputText">Label</label>
<input type="text" id="inputText" onchange="changeLabel();">

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
    function changeLabel()
    {
        $("#label").text($("#inputText").val());
    }
</script>

</body>
</html>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900