I'm a super-newbie with JS, so maybe the question is super stupid.
I got this JS that is started correctly in every page. but in some cases in this blog, I want to run the same script when I go to < mysite.com/page/2 > where the page is not reloaded but only the content change.
I think I should use something like "hashchange" in the eventlistners but is not working, cause is not an hash.
I don't want to run the JS after a certain ammount of time, cause is a dirty solution, and I can't change the code cause is a wordpress template, I can only edit it trough JS.
any suggestion?
I tried everything, in the event parameters: scroll, load, change, but nothing work, please give me suggestions. :(
waiting for yours, I leave you my code and the link on what I'm working in order to show you better the situation.
document.addEventListener("DOMContentLoaded", addStuff);
document.addEventListener("hashchange", addStuff); //<--- THIS IS NOT WORKING
function addStuff()
{
var x = document.getElementsByClassName("t-entry-cf-detail-106360");
var i;
for (i = 0; i < x.length; i++) {
x[i].innerHTML = "<a href='http://www.filmidee.it/tag/" + x[i].innerHTML.replace(/\s+/g, '-') + "'>" + x[i].innerHTML + "</a>";
}
};