Question

We are going to use the developer tools and the DOM function document.QuerySelectorAll(css_selector_string) to test some...

We are going to use the developer tools and the DOM function document.QuerySelectorAll(css_selector_string) to test some selectors and look at document structure.

a.What is the CSS selector that you would use to select all the <code> elements? How many are there?

b.What is the CSS selector that you would use to select all the <code> elements contained in <pre>elements? How many are there? Are there more or less than above. Why?

c.What is the CSS selector that you would use to select all the <figure> elements? How many are there?

d.What is the CSS selector that you would use to select all the <img> elements? How many are there? Is this different from the above? Why?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

//a.
var code = document.QuerySelectorAll("code");
console.log("Total <code> elements: "+code.length);
//b.
var preCode = document.QuerySelectorAll("pre>code");
console.log("Total <code> elements in <pre> tag: "+preCode.length);
console.log("Is code.length is > preCode.length");
console.log(code>preCode);
//c.
var figures = document.QuerySelectorAll("figure");
console.log("Total <figure> elements: "+figures.length);
//d.
var img = document.QuerySelectorAll("img");
console.log("Total <img> elements: "+img.length);
console.log(img.length+">"+figures.length+"="+(img.length>figures.length));

Add a comment
Know the answer?
Add Answer to:
We are going to use the developer tools and the DOM function document.QuerySelectorAll(css_selector_string) to test some...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT