Python quickly to be able to see it. Entities. 0:49 1:35 When working with HTML, you'll use classes to give elements a particular style with CSS. Media Queries, HTML Must be a valid event: childSelector: Optional. So over an index.html, let's add a few Get the Latest Tech News Delivered Every Day, Christopher Robbins / Photodisc / Getty Images, How to Use the Span and Div HTML Elements, How to Use Multiple CSS Classes on a Single Element, How to Create Zebra Striped Tables With CSS, How to Change the Color of a Word With the Span Tag and CSS, How to Change Website Font Colors With CSS, Get to Know Cascading Style Sheets With This CSS Cheat Sheet, How to Float an Image to the Left of Text on a Webpage, use commas to separate multiple grouped selectors. Donations to freeCodeCamp go toward our education initiatives, and help pay for servers, services,

oranges with the class,

Cat Get and display the ‘rel’ attribute of an element that is clicked using javascript. As a side benefit of this approach, you can dynamically add elements to the DOM without having to add additional event listeners. curriculum.

Array Sort, Symlink the word Tag to Class. you'll use classes to give the elements Unlike some selectors that we’ll get to later in the article, there is no need for a # to denote element id. Turns out I had used document.querySelectorAll() to assign my elements to a variable, and then I was attempting to change those elements. Specifies one or more event(s) or namespaces to attach to the selected elements. To select elements with the same class we Tax Identification Number: 82-0779546).

Sign In 0:24 The passed in string must match a valid CSS selector — id, class names, types, attributes, values of attributes, etc. Hi There, This happens because you are not allowed to use more than one of a unique ID per page.

To that end, I hope to “hand you a shovel” after you’ve read this article. If you do not wish to convert, you can still iterate over the node list with a for…in statement. So let's start by changing give them a class of error not purple,

This selector returns multiples that match the passed-in string and arranges them into another array like structure known as a node list. So I'll replace all instances Still, every bit of optimization helps, and if you can shave some size off your CSS and load the pages that much faster, that's a good thing. 1:42 Often when working with HTML, So we'll pass that into this method. Now the Class we want is error-not-purple. in JSON.

The bottom line: Grouping CSS selectors boosts efficiency, productivity, organization, and in some cases, even load speed. Class name selector — again notice the “S” in elements — this selector returns multiples in an array-like structure known as an HTML collection of class names. then we'll see how to select them.

the myList constant here. Use e.target.classList.contains('to--click'). errorNotPurple class will be turned red.