Tecnical documentation page

Hello,
the exercise requires:
…the navbar should contain link ( a ) elements with the class of nav-link . There should be one for every element with the class main-section

If I try to use more than one class in addition to nav-link, the software no longer sees the nav-link class and tells me that it is absent, for example:

<a href="#" class="nav-link other-class">some text hee</a>

I can only put the nav-link class to go forward:

<a href="#" class="nav-link" >text here</a>

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36

Challenge: Build a Technical Documentation Page

Link to the challenge:

Can you post the full code, so that it will be easier to find the problem.
It might be a problem with freecodecamp

Here’s the test code:

const els = document.querySelectorAll('a[class="nav-link"]')
assert(els.length >= 1)

As you said, that will only find elements with exactly class="nav-link", which I hope was not their intention.

The test code should likely be updated to query for a.nav-link instead. I’ll file an issue on GitHub.

I believe that the problem is spread to all applications, for example :

<nav id="sidebar-nav navbar"> </nav> 

it is not accepted and the software does not see the navbar ID and keeps saying it is not present, but technically speaking it is present .

const el = document.getElementById('navbar')
assert(!!el && el.tagName === 'NAV')

The id attribute can’t contain whitespace though, so that’s invalid HTML.

Ops, you are right, thanks.

Looks like the fix went up so you can use multiple classes now, check it out!

1 Like

Thank you, problem solved :+1:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.