var checks = {"1405":"1405","3225":"3225","1402":"1402","2303":"2303","2133":"2133","811":"811","202":"202","488":"488","2308":"2308","3232":"3232"}; $(document).ready(function(){ for (item in checks) { if ($("#C" + item)) $("#C" + item).removeClass("fa-heart-o").addClass("fa-heart"); } $("#myCounter").html('(10)') });