Answer the question
In order to leave comments, you need to log in
What are the ways to dynamically build an interface, DOM?
Good day! Forced to write an interface on Ajax requests. It's so bad. You need to generate DOM elements from JS.
I didn’t come up with anything better than Jquery, and it turns out such a healthy footcloth:
let hTpl = '<div data-guid = "#GUID" class = "col-md-12 project-container__item">\
<span class = "project-item__number">#NUMBER</span>\
<span class = "project-item__title">#NAME</span>\
<div class = "project-item__control">\
<img src = "img/i_play.png">\
<img src = "img/i_refresh.png">\
</div>\
<div class = "project-item__progress">\
<progress class = "midea-progress--little" max="100" value="#PROGRESS"></progress>\
<span class = "midea-progress--little">#PROGRESS%</span>\
</div>\
</div>';
hTpl = hTpl.replaceAll('#NAME', arProject[ii].NAME);
hTpl = hTpl.replaceAll('#GUID', arProject[ii].GUID);
hTpl = hTpl.replaceAll('#NUMBER', ii);
hTpl = hTpl.replaceAll('#PROGRESS', arProject[ii].PROGRESS);
$(document).ready(function () {
$('.js-progress-reload').click(function () {});
$('.js-progress-stop').click(function () {});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question