.innerhtml
// .innerHTML method is used to change the html contents of a DOM object
document.getElementById("demo").innerHTML = "Paragraph changed!";
.innerhtml
// .innerHTML method is used to change the html contents of a DOM object
document.getElementById("demo").innerHTML = "Paragraph changed!";
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>';
javascript innerhtml
document.getElementById("example").innerHTML = "Paragraph changed!";
js innerHTML
document.getElementById("Test").innerHTML = "<p style='color:red;'>Test</p>";
innerhtml in javascript
<p id="demo" class="demo_class"></p>
<script>
//simple
document.getElementById("demo").innerHTML = "hello World";
//advance
document.getElementById("demo").innerHTML = person("ahsan", "21");
function person(name1, age1) {
return ("Your name is " + name1 + ". You're " + age1 + " years old.");
}
</script>
js create element innerhtml
function createElement( str ) {
var frag = document.createDocumentFragment();
var elem = document.createElement('div');
elem.innerHTML = str;
while (elem.childNodes[0]) {
frag.appendChild(elem.childNodes[0]);
}
return frag;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us