var checks = {"499":"499","1132":"1132","5":"5","503":"503","2145":"2145","1037":"1037","1044":"1044","827":"827","2904":"2904","2146":"2146","2142":"2142","2144":"2144","2018":"2018","2912":"2912","1036":"1036"}; $(document).ready(function(){ for (item in checks) { if ($("#C" + item)) $("#C" + item).removeClass("fa-heart-o").addClass("fa-heart"); } $("#myCounter").html('(15)') });