How to add data to HTML code with javascript (other methods can without PHP)?

Hello, there is a problem. A website landing page with the goods, a lot of goods, so in the future all code will not be very convenient whether it is possible to display the values that we write in script code into the HTML code in <span></span> for example? Perhaps there are other ways to implement the ideas without PHP?
July 9th 19 at 10:49
3 answers
July 9th 19 at 10:51
Of course, you can, actually JavaScript in the first place to do this (work with the DOM) and is designed from document.body.innerHTML += 'value'; and ending Angular.js etc.
Shouldn't be hard to give a specific example, suppose we have a span with a class sudalyvauti how will all this be implemented? Thank you! - cordell.Cremin commented on July 9th 19 at 10:54
*a span with class "price" - cordell.Cremin commented on July 9th 19 at 10:57
For a long time to write, samoei simple:


You can make an array (and loop output), you can use jQuery for brevity, etc. - mazie.Towne commented on July 9th 19 at 11:00
July 9th 19 at 10:53
In fact, js is also not very convenient will later add all. But it is possible. Therefore it will be easier to use any type of template engine jade.
Shouldn't be hard to give a specific example, suppose we have a span with class "price" how is all this implemented? Thank you! - cordell.Cremin commented on July 9th 19 at 10:56
July 9th 19 at 10:55
you can load content from html, json, txt Ajax through the jquery: .load()
Shouldn't be hard to give a specific example, suppose we have a span with a class sudalyvauti how will all this be implemented? Thank you! - cordell.Cremin commented on July 9th 19 at 10:58
*a span with class "price" - cordell.Cremin commented on July 9th 19 at 11:01
by : selector on jquery. read the documentation of jquery. - mazie.Towne commented on July 9th 19 at 11:04

Find more questions by tags HTMLJavaScriptjQuery