1<!DOCTYPE html>
2<html>
3<body>
4
5<button id="demo" onclick="myFunction()">Click me to change my HTML content (innerHTML).</button>
6
7<script>
8function myFunction() {
9 document.getElementById("demo").innerHTML = "Paragraph changed!";
10}
11</script>
12
13</body>
14</html>
15
1<button id="buttonName">Old Text</button>
2<script>document.getElementById('buttonName').innerText = 'New Text';</script>
1var btn = document.getElementById("mybtn");
2btn.value = 'my value'; // will just add a hidden value
3btn.innerHTML = 'my text';
4