I have a page that is loading ajax content in. In the ajax content I have a button that I want to click. upon clicking i want to click the .jb-close-button. I have tried another .on method, click method and trigger method.
$('body').on('click','button', relatedArticles);
function relatedArticles() {
var whereto = $(this).attr('href');
related = $('body').find(whereto);
$('.jb-close-button').trigger();
return false;
}