curriculum/challenges/english/blocks/lab-debug-pet-adoption-page/685239f0cad43c7a909cbd98.md
Sally, a pet adoption store owner, has built her first web page but there are some issues.
Your job is to fix all of the errors so Sally can continue building her page.
Objective: Fulfill the user stories below and get all the tests to pass to complete the lab.
User Stories:
img element:
href attribute with the correct attribute for the image source.att attribute with the correct attribute representing short, descriptive text for images.</img> closing tag because img elements are void elements and don't have closing tags.a elements:
src attributes with the correct attributes used to specify URLs.Your img element should have a src attribute instead of the href attribute.
const imgEl = document.querySelector("img");
assert.isTrue(imgEl.hasAttribute("src"));
Your img element should have an alt attribute instead of the non-existent att attribute.
const imgEl = document.querySelector("img");
assert.isTrue(imgEl.hasAttribute("alt"));
Your img element should not have a </img> closing tag.
assert.notMatch(code, /<\/img>/);
Your a element with the text Visit cats page needs to have an href attribute instead of a src attribute.
const anchors = document.querySelectorAll("a");
const catLink = Array.from(anchors).find(a => a.textContent.trim() === "Visit cats page");
assert.isDefined(catLink);
assert.isTrue(catLink.hasAttribute("href"));
Your a element with the text Visit dogs page needs to have an href attribute instead of a src attribute.
const anchors = document.querySelectorAll("a");
const dogLink = Array.from(anchors).find(a => a.textContent.trim() === "Visit dogs page");
assert.isDefined(dogLink);
assert.isTrue(dogLink.hasAttribute("href"));
<h1>Welcome XYZ Pet Adoption!</h1>
<p>Consider adopting a pet today. We have cats, dogs, rabbits and more.</p>
<h2>See our cats!</h2>
</img>
<h2>Adopt a cat!</h2>
<a src="/cats">Visit cats page</a>
<h2>Adopt a dog!</h2>
<a src="/dogs">Visit dogs page</a>
<h1>Welcome XYZ Pet Adoption!</h1>
<p>Consider adopting a pet today. We have cats, dogs, rabbits and more.</p>
<h2>See our cats!</h2>
<h2>Adopt a cat!</h2>
<a href="/cats">Visit cats page</a>
<h2>Adopt a dog!</h2>
<a href="/dogs">Visit dogs page</a>