Code Library
Home Submit Free Hosting Link To Us Contacts

JavaScript Input content change

JavaScript Input content change JavaScript JavaScript Input content change Download (.zip)



<script type="text/javascript">
function changeText(newText) {
        elem = document.getElementById("para1");
        elem.value = newText;
}
</script>
</head>

<body>
<input id="para1" value='Some text here'>

<button onclick="changeText('newtext');">blue</button>
<button onclick="changeText('othertext');">red</button>
</body>
</html>






Tatet