When you lastOne selection lastOne first time, nothing is assigned, and JavaScript throws an error and stops working from this point, since lastOne will never be attached to anything.
var lastOne; function selection(event) { event.target.style.width = "50px";
I would fix this by doing the following:
var lastOne; function selection(event) { if(lastOne) { lastOne.style.width = "10px"; } event.target.style.width = "50px"; current = event.target.id; lastOne = document.getElementById(current); }
source share