Y
Y
Yaroslav Rul2018-03-06 17:35:23
JavaScript
Yaroslav Rul, 2018-03-06 17:35:23

How to change the content of paragraphs to their serial number in the code?

You need to replace the contents of the paragraphs with their serial number in the code. Without using jQuery
The number of paragraphs can change.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ramil, 2018-03-06
@SpaceX_1

document.querySelectorAll('.paragraph')
  .forEach((item, index) => item.innerHTML = index + 1)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question