(function (){
var stones = parseInt($('body').attr('data-site')) + 1,
theul = $(".submenu > ul li:nth-child(" + stones + ")");
console.log(theul);
$('theul').addClass('active');
console.log(theul);
})();
Logs shows the exact same thing before and after adding the class.

Your selector is wrong, it should be: