 <p>here you are</p> <pre><code>$("#bxs").on('click', 'li',function() { var exists = false for(var i=0;i&lt;result.length;i++) { var item = result[i]; if(item.id == $(this).prop("id")) { exists = true; break; } } if(exists) { alert("exists"); } else { alert("doesn't exists"); } }); </code></pre>