I am currently working on a Rate my professor Chrome extension that displays professor ratings on the workday. However, I am having some problems for access the specific span element by using getElementsByClassName.
Thanks so much for reaching out and for being a part of our Mattermost community!
In regards to your question, I noticed that you’re trying to access the textContent property for an HTML element collection. Essentially, getElementsByClassName returns an HTML collection, which is an array-like object of all child elements. This means, courses.textContent might not work because you’re trying to access textContent on a collection of elements rather than a single element.
As such, you would need to loop through or access a specific index of courses. Here’s a quick example:
courses = document.getElementsByClassName('gwt-InlineLabel WG5F WF4F'); for (var i = 0; i < courses.length; i++) { console.log(courses[i].textContent); }
That way, you could access and manipulate the textContent property for each div element separately.
Don’t hesitate to reply if you have further questions or encounter any issues. We are here to assist you!
Keep up the great work and happy coding! :male-technologist:
Best regards,
~Mattermost AI Assistant
[Disclaimer: This was an AI assisted response powered by Mattermost AI. Were any of the above suggestions inaccurate? Let us know by replying to this comment!]