// create div element by javascript with class var div = document.createElement('div'); div.className = "div1";