How to select the HTML of this particular element?


How to select the HTML of this particular element?

Hi all. Beginner JS programmer here. I'm trying to select the HTML of a particular element on this page. The element is the title 'Architects' towards the bottom of the page. It has a class of 'guidance,' and when I enter

document.querySelectorAll(".guidance") 

into the console, it does indeed return

[h3.guidance] 

which I can expand to show its various properties, including innerHTML and outerHTML. But when I try to return either of them using

document.querySelectorAll(".guidance").innerHTML 

it returns 'undefined.'

I've tried using "h3.guidance" instead, but with no luck. I also tried ".guidance h3", which has worked for me in the past. But this particular element is a bit different than those I've worked with before–possibly due to the ::before pseudo-selector–I'm not sure though.

Can someone point me in the right direction?

The end goal is to add a hyperlink to the text in-question.

Thanks in advance.

edit: Thanks to /u/paooolino, I resolved my issue. I was using querySelectorAll instead of querySelector. Consider this resolved.

Submitted July 11, 2017 at 09:20PM by cag8f
via reddit http://ift.tt/2uenrgE

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s