there is a link on my website. When I click on it a colorbox opens with some content.
There is a link in the colorbox's content and I want to add a click event on that link but its not working.
$('.link').on('click', function() {
alert('a');
});
there is a link on my website. When I click on it a colorbox opens with some content.
There is a link in the colorbox's content and I want to add a click event on that link but its not working.
$('.link').on('click', function() {
alert('a');
});
Jquery only works with elements that are loaded. make sure that you are setting up this code after the colorbox is loaded. you can do that by wrapping it in a
$(doument).ready(function(){});
on the colorbox html page
$(doument).ready(function(){
$('.link').on('click', function() {
alert('a');
});
});