I wish to add a new attribute to all of my elements that their type is text
Can you please let me know where I'm wrong?
Firstly, I identify all my elements that their type is text as follows (input tag name is the tag name that contains text types)
var inputs = document.getElementsByTagName('input');
Secondly, I add my attribute to those with text type
if (inputs.type =='text') {var att = document.createAttribute("class")}
Then when I want to check if the new attribute is added or not
inputs.hasAttribute("class");
I got this error
Uncaught TypeError: inputs.hasAttribute is not a function