Doesn't the name of the getElementsByClassName
method give you a hint that it should return not a single element but multiple elements? Because there can be many elements with the same class in the document. Read the docs more carefully.
If you're familiar with CSS, there is document.querySelectorAll
method, which retrieves elements via CSS selectors.
var plusLinks = document.querySelectorAll('a.no-js')
Then you can access individual links by their numeric index:
var firstLink = plusLinks[0]
As for the class
attribute (and it is class
attribute, not no-js
attribute), you shouldn't remove it, but set it to a new value.
firstLink.setAttribute('class', 'js')
Or:
firstLink.className = 'js'
Since you want to remove the hover effect, and the body element already has no-js
class on it, you can replace the class once for the whole page:
document.body.className = 'js'