K
K
Kusmich2015-11-02 22:50:18
JavaScript
Kusmich, 2015-11-02 22:50:18

How to correctly insert a value from an object into an element?

json arrives {"name": "Denis" , "name": "Nikolai", "name": "Vladislav", "name": "Eugene", "name": "Alexander" }

And the html markup already has 5 tags <h1>. It is necessary that the values ​​are written to the elements in order. For example: <h1>Денис</h1>, <h1>Николай</h1>, <h1>Владислав</h1>, <h1>Евгений</h1>, <h1>Александр</h1>.
I tried using append, but for some reason, the last value is written to all elements.

How is it syntactically correct to write such a traversal of elements?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jlekapb, 2015-11-02
@Kusmich

use each to iterate over tags

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question