I have some results that are loaded via Ajax
in the #results
container and anothers, the same content in #last_results
(this one loads without ajax). The same scripts that work on #last_results
doesnt work in #results
I think due to they are not binded.
HTML
<ul id="results"></ul>
<ul id="last_results">
<li class=showLb>[click to show LightBox]</li>
<li class=showLb>[click to show LightBox]</li>
<li class=showLb>[click to show LightBox]</li>
</ul>
JQUERY This is a basic Jquery script:
$('.showLb').on('click',function(e){
alert('Show LightBox');
});
This script works in the page li
but not in the loaded via Ajax li
. I knew I have to delegate
or use on
, How