Let me break it down into critical parts:
Question 1:
What is the difference between class and class name in javascript?
The title of the question.
Answer 1:
A class is an attribute in an html element <span class='classy'></span>
Although, on the other hand, .className is a property that can be called by an element to get / set its class.
var element = document.createElement('span'); element.className = 'classy'
Setting a class can also be done using .getAttribute('class') and .setAttribute('class', 'classy') . We often change manipulation classes, however, that it deserves its own .className method.
Question 2:
However, when I replace className above with a class in the above function, the code does not work. So I naturally wonder what the difference is between class and class Name.
Answer 2: element.class is not a property.
A class may be an attribute of an element, but you cannot name it as el.class . The way you do this is el.className , as you have already figured out . If you look at the MDN for an element , you will see that the elements have many properties and methods, but .class not one.

Question 3:
Also the best way to return a list of children of a specific class name for a shared object?
Answer 3: Use .getElementsByClassName
Instead of using the objective function, people often βhookβ methods one by one in order to achieve the desired effect.
Based on your needs, I think you are asking for the .getElementsByClassName method. Here are the complete documents and excerpt:
The returned method Element.getElementsByClassName () returns a live HTMLCollection [array] containing all the child elements that have all the specified class names.
Reusing the example from your answer:
var li = document.createElement('li'); var input = document.createElement('input'); input.setAttribute('class','answer_input'); li.appendChild(input); console.log(li.getElementsByClassName("answer_input")[0]);