There is a code:

$(".gametime").append(moment.tz('16/3/0:45', 'DD/MMMM/HH/mm', 'Europe/Moscow').tz(user_tz).format('DD MMMM HH:mm')); $(".gametime2").append(moment.tz('16/3/02:45', 'DD/MMMM/HH/mm', 'Europe/Moscow').tz(user_tz).format('DD MMMM HH:mm')); 

There is a p tag with a gametime class

 <p class="gametime1"></p> <p class="gametime2"></p> 

As you can understand, I embed different times (code) in different classes. But I can't figure out how to automate this process or something ... So that on the modx engine the admin creates a class and time, and the time was exactly applied to the newly created div

  • The essence of the question is incomprehensible - yolosora

1 answer 1

  function updateTime() { $(".gametime1").append(moment.tz('16/3/0:45', 'DD/MMMM/HH/mm', 'Europe/Moscow').tz(user_tz).format('DD MMMM HH:mm')); // Добавить контент в болк .gametime1 $(".gametime2").append(moment.tz('16/3/02:45', 'DD/MMMM/HH/mm', 'Europe/Moscow').tz(user_tz).format('DD MMMM HH:mm')); // Добавить контент в болк .gametime2 } setInterval(updateTime, 100); //Выполнять функцию раз в 100 милисекунд