- Local time
- Sep 24, 2019
I am fetching data from external JSON (latest threads), looping through it and putting it in to page. That's all working well. There's just one line that's annoying me. Although it works it is very convoluted and going to be harder to make much more complex. I understand this is one of the problems frameworks solve but is there a better way in vanilla that will see me through this project?
document.querySelector('#threads-list').innerHTML += '<a href="https://webwide.io/threads/' + element['thread_id'] + '" target="_blank"><div class="thread"><img src="' + avatar + '" alt="User Avatar"><div><div class="title">' + element['title'] + '</div><div class="meta">' + element['last_post_username'] + ' replied ' + timeSince(element['last_post_date']) + ' ago</div></div></div></a>';