+ 5
Can someone transform this in Jquery ?
Thanks :) var tab = document.querySelectorAll("#table div"); var page = tb = null; for(var i=0;i<tab.length;i++) { tab[i].addEventListener("click", function(e){ if(page!==null) { document.getElementById(page).style.display = 'none'; tb.target.style.backgroundColor = "white"; tb.target.style.color = "black"; } tb = e; page = e.target.dataset.page; document.getElementById(page).style.display = "block"; e.target.style.backgroundColor = "#444"; e.target.style.color = "white"; },false); }
2 Respostas
+ 7
because all the rest of my document is in jquery except this
+ 2
and what for?)) if you wanna include jQuery to your project, this code will work well without some changes