var checks = {"4002":"4002","735":"735","1772":"1772","2495":"2495","1811":"1811","3823":"3823","384":"384","4013":"4013","3996":"3996","2875":"2875","3337":"3337","2505":"2505","1799":"1799","1803":"1803"}; $(document).ready(function(){ for (item in checks) { if ($("#C" + item)) $("#C" + item).removeClass("fa-heart-o").addClass("fa-heart"); } $("#myCounter").html('(14)') });