Have you tried:
document.getElementById("textboxelement").innerHTML = "Changed text!";
Textbox Changes Dynamically
Moderators: egami, macek, gesf
-
- php-forum GURU
- Posts: 974
- Joined: Mon Oct 01, 2012 12:32 pm
1) you're not going to set a value without returning a value from the function
2) there are a lot of ways to do what you're trying, here's a jquery solution that works for me.
2) there are a lot of ways to do what you're trying, here's a jquery solution that works for me.
Code: Select all
<!DOCTYPE html>
<html>
<head>
<script src="jquery.js"></script>
<script>
$(document).ready(function(){
$("#t1").click(function(){
$("#t1").val(returnText$("#t2").val()));
});
$("#t2").click(function(){
$("#t2").val(returnText$("#t1").val()));
});
});
</script>
<script type="text/javascript">
function returnText(str)
{
switch (str) {
case "" : str="VG";
break;
case "VG" : str="G";
break;
case "G" : str="P";
break;
case "P" : str="N";
break;
case "N" : str="";
break;
default : str="";
break;
}
return str;
}
</script>
</head>
<body>
<form name=f1 action="#" method="post">
<input type="text" id="t1" />
<input type="text" id="t2" />
</form>
</body>
</html>