This is my code
for(var i=0;i<Year12.length;i++)
{
var div1=document.createElement('li');
div1.setAttribute('id',Year12[i]);
div1.setAttribute('Value',Year12[i]);
document.getElementById("Jan").appendChild(div1);
alert(div1);
}
“jan” is the id of an UL element.I am able to create the Element. But Its not adding to the parent element.Can any one try this
Remove Value and try:
OR
For setting class, you can do: