add innerhtml javascript code example

Example 1: .innerhtml

// .innerHTML method is used to change the html contents of a DOM object
document.getElementById("demo").innerHTML = "Paragraph changed!";

Example 2: javascript innerhtml

document.getElementById("example").innerHTML = "Paragraph changed!";

Example 3: javascript innerhtml table

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>';

Example 4: js innerHTML

document.getElementById("Test").innerHTML = "<p style='color:red;'>Test</p>";

Example 5: what is the meaning of the table innerhtml in javascript

table.innerhtml

Tags:

Html Example