What is the error in the code?

var parent = document.querySelector('.number');
var text = document.querySelector('.text');
var clas = document.querySelector('.input__box');

var input = document.createElement('input');
input.type = 'text';
input.class = 'clas';
parent.insertBefore(input, parent.firstChild);


Creates and registers input type='text' and the class is not listed,why?
March 25th 20 at 13:28
3 answers
March 25th 20 at 13:30
Solution
input.className = 'clas';
March 25th 20 at 13:32
input.className Try this.
March 25th 20 at 13:34
input.className

Find more questions by tags JavaScript