I have this code code.
It's work in jsfiddle but the problem when I test it in my file it's not working.
I have only displayed the first three lines created by html :
test h1
test h2
test p
(I test the code in different browsers and javascript is work but the same problem).
Code :
var div2= document.createElement('div');
div2.className = "div2" ;
var h1 = document.createElement('h1');
h1.innerHTML= "test h1" ;
var h2 = document.createElement('h2');
h2.innerHTML= "test h2" ;
var p = document.createElement('P');
p.innerHTML= "p2" ;
div2.appendChild(h1);
div2.appendChild(h2);
div2.appendChild(p);
document.getElementById('div1').appendChild(div2);
Thank you.
div1?