Files
Naomi Carrigan 16e7cdedb1 feat: migrate filenames to IDs (#45146)
* feat: migrate filenames to IDs

* feat: migrate balance sheet file names

* revert: no id name for cert projects

* fix: i swear i know what i'm doing
2022-03-02 09:06:00 -06:00

80 lines
2.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: 5dc24614f86c76b9248c6ebd
title: Step 10
challengeType: 0
dashedName: step-10
---
# --description--
You can link to another page with the anchor (`a`) element. For example, `<a href='https://freecodecamp.org'></a>` would link to `freecodecamp.org`.
Add an anchor element after the paragraph that links to `https://freecatphotoapp.com`. At this point, the link wont show up in the preview.
# --hints--
Your anchor (`a`) element should have an opening tag. Opening tags have this syntax: `<elementName>`.
```js
assert(document.querySelector('a'));
```
Your anchor (`a`) element should have a closing tag. Closing tags have a `/` just after the `<` character.
```js
assert(code.match(/<\/a\>/));
```
Your anchor (`a`) element should be below the `p` element. You have them in the wrong order.
```js
const collection = [...document.querySelectorAll('a, p')].map(
(node) => node.nodeName
);
assert(collection.indexOf('P') < collection.indexOf('A'));
```
Your anchor (`a`) element does not have an `href` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
```js
assert(document.querySelector('a').hasAttribute('href'));
```
Your anchor (`a`) element should link to `https://freecatphotoapp.com`. You have either omitted the URL or have a typo.
```js
assert(
document.querySelector('a').getAttribute('href') ===
'https://freecatphotoapp.com'
);
```
Although you have set the anchor ('a') element's `href` attribute to the correct link, it is recommended to always surround the value of an attribute with quotation marks.
```js
assert(
!/\<a\s+href\s*=\s*https:\/\/www.freecodecamp.org\/cat-photos/.test(code)
);
```
# --seed--
## --seed-contents--
```html
<html>
<body>
<h1>CatPhotoApp</h1>
<main>
<h2>Cat Photos</h2>
<!-- TODO: Add link to cat photos -->
--fcc-editable-region--
<p>Click here to view more cat photos.</p>
--fcc-editable-region--
<img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back.">
</main>
</body>
</html>
```