Q:

how to create class attribute using dom in javascript

I am creating input tag with it's attributes by clicking on list item. Type, name and id are created successfully but it's not generating the class attribute.
var createInput = document.createElement("input");
        createInput.type = "text";
        createInput.name = text1;    
        createInput.id = text1;
        createInput.class = "abc";

A:

The class property of a DOM Element is actually called className:
createInput.className = "abc";

Check out your browser's Debug Console (F12); it has auto-completion, so you can see what properties exist.

