Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Practicing Highlighting Items | Understanding and Selecting Elements
DOM Manipulation with JavaScript

bookPracticing Highlighting Items

To highlight multiple items on a web page, you need to select all the elements you want to change and then modify their appearance. Suppose you have a list of items and you want to highlight them by changing their background color. You can do this by first selecting all the list items using a method like querySelectorAll, which returns a collection of elements. Once you have this collection, you can loop through each item and update its style. This approach is useful when you want to apply the same change to several elements at once, such as highlighting all tasks in a to-do list or marking important entries in a table.

index.html

index.html

highlight.js

highlight.js

copy
question mark

Which of the following statements correctly describes how to highlight all <li> elements on a page using JavaScript?

Select the correct answer

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 5

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

Suggested prompts:

Can you show me an example of how to use `querySelectorAll` to select multiple items?

How do I change the background color of the selected elements?

Are there other ways to highlight multiple items besides changing the background color?

Awesome!

Completion rate improved to 6.67

bookPracticing Highlighting Items

Свайпніть щоб показати меню

To highlight multiple items on a web page, you need to select all the elements you want to change and then modify their appearance. Suppose you have a list of items and you want to highlight them by changing their background color. You can do this by first selecting all the list items using a method like querySelectorAll, which returns a collection of elements. Once you have this collection, you can loop through each item and update its style. This approach is useful when you want to apply the same change to several elements at once, such as highlighting all tasks in a to-do list or marking important entries in a table.

index.html

index.html

highlight.js

highlight.js

copy
question mark

Which of the following statements correctly describes how to highlight all <li> elements on a page using JavaScript?

Select the correct answer

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 5
some-alt