Goal: Practice accessing DOM element attributes by using document
methods and dot notation to access the properties that we learned about in previous lessons.
document.querySelector()
instead of window.document.querySelector()
?Clone down the Cookie Recipe HTML and open it in your web browser. Then, use the DevTools console to practice accessing different DOM elements and their attributes by working through each prompt below. Reference the previous lesson "Accessing HTML Element Attributes in the DOM" as needed. You should be able to complete all of the following prompts with just the information in the lesson.
<em>
tag of the paragraph element.Object.prototype.toString.call();
.Switch who's driving and observing, and complete the remaining prompts:
alt
attribute for the image.Object.prototype.toString.call();
.<body>
to change the font weight to the value "700"
. Bonus:
style
object properties and apply a new style to any element.