Reputation: 2915
I have a close button in a Modal lightbox View. But if you click on the button the window does not close.
Here my HTML Code:
<a href="#" data-featherlight="#fl1">lösche</a>
<div class="lightbox" id="fl1">
<h2>Delete Item</h2>
<div class="row">
<div class="twelve columns">
<strong>Are you Sure?</strong><br>
blubblub?
</div>
</div>
<div class="right">
<a href="#" class="btn btn_gray no text_none" id="close_button">Close</a>
<a href="#" class="btn btn_red text_none">Yes</a>
</div>
</div>
Here my jQuery code:
// Close Button featherlight
jQuery('#close_button').click(function(){
console.log("test");
jQuery('.featherlight').click();
});
Upvotes: 0
Views: 3185
Reputation: 74420
Plugin seems to generate element on the fly (cloning without bound datas???), you need then to delegate event, e.g:
jQuery(document).on('click','#close_button',function(){
console.log("test");
jQuery('.featherlight').click();
});
Upvotes: 3