Adam
0
Q:

js innerHTML

document.getElementById("Test").innerHTML = "<p style='color:red;'>Test</p>";
1
document.getElementById("p1").innerHTML = "New text!";
11
// .innerHTML method is used to change the html contents of a DOM object
document.getElementById("demo").innerHTML = "Paragraph changed!";
5
document.getElementById("myelement").innerHTML='<table id="mytable"><thead><tr><th>Row 1 - Column 1 - Header</th><th>Row 1 - Column 2 - Header</th></tr><thead><tr><td>Row 2 - Column 1</td><td>Row - 2 Column 2</td></tr><tr><td>Row 3 - Column 1</td><td>Row 3 - Column 2</td></tr></table>';
0

document.getElementById("demo").innerHTML = "";  // Replaces the content of <p> with an empty string 
3
document.getElementById("example").innerHTML = "Paragraph changed!";
1

 var x = document.getElementById("myList").innerHTML; 
0

<html>

<body>


<p id="p1">Hello World!</p>


<script>

document.getElementById("p1").innerHTML = "New text!";

</script>


</body>

</html>
 
-2
table.innerhtml
-2

New to Communities?

Join the community