--- id: bad87fee1348bd9aede08817 title: Nest an Anchor Element within a Paragraph challengeType: 0 videoUrl: 'https://scrimba.com/p/pVMPUv/cb6k8Cb' --- ## Description
You can nest links within other text elements.
<p>
Here's a <a target="_blank" href="http://freecodecamp.org"> link to freecodecamp.org</a> for you to follow.
</p>
Let's break down the example: Normal text is wrapped in the p element:
<p> Here's a ... for you to follow. </p> Next is the anchor element <a> (which requires a closing tag </a>):
<a> ... </a> target is an anchor tag attribute that specifies where to open the link and the value "_blank" specifies to open the link in a new tab href is an anchor tag attribute that contains the URL address of the link:
<a href="http://freecodecamp.org"> ... </a> The text, "link to freecodecamp.org", within the anchor element called anchor text, will display a link to click:
<a href=" ... ">link to freecodecamp.org</a> The final output of the example will look like this:

Here's a link to freecodecamp.org for you to follow.

## Instructions
Now nest your existing a element within a new p element (just after the existing main element). The new paragraph should have text that says "View more cat photos", where "cat photos" is a link, and the rest of the text is plain text.
## Tests
```yml tests: - text: You need an a element that links to "http://freecatphotoapp.com". testString: assert(($("a[href=\"http://freecatphotoapp.com\"]").length > 0 || $("a[href=\"http://www.freecatphotoapp.com\"]").length > 0), 'You need an a element that links to "http://freecatphotoapp.com".'); - text: Your a element should have the anchor text of "cat photos" testString: assert($("a").text().match(/cat\sphotos/gi), 'Your a element should have the anchor text of "cat photos"'); - text: Create a new p element around your a element. There should be at least 3 total p tags in your HTML code. testString: assert($("p") && $("p").length > 2, 'Create a new p element around your a element. There should be at least 3 total p tags in your HTML code.'); - text: Your a element should be nested within your new p element. testString: assert(($("a[href=\"http://freecatphotoapp.com\"]").parent().is("p") || $("a[href=\"http://www.freecatphotoapp.com\"]").parent().is("p")), 'Your a element should be nested within your new p element.'); - text: Your p element should have the text "View more " (with a space after it). testString: assert(($("a[href=\"http://freecatphotoapp.com\"]").parent().text().match(/View\smore\s/gi) || $("a[href=\"http://www.freecatphotoapp.com\"]").parent().text().match(/View\smore\s/gi)), 'Your p element should have the text "View more " (with a space after it).'); - text: Your a element should not have the text "View more". testString: assert(!$("a").text().match(/View\smore/gi), 'Your a element should not have the text "View more".'); - text: Make sure each of your p elements has a closing tag. testString: assert(code.match(/<\/p>/g) && code.match(/

/g).length === code.match(/

p elements has a closing tag.'); - text: Make sure each of your a elements has a closing tag. testString: assert(code.match(/<\/a>/g) && code.match(//g).length === code.match(/a elements has a closing tag.'); ```

## Challenge Seed
```html

CatPhotoApp

cat photos A cute orange cat lying on its back.

Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.

Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.

```
## Solution
```js // solution required ```