.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
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;
}
innerHTML
document.getElementById("Test").innerHTML = "<h1>Test</h1>";
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