Reload js behaviors after click I'm using boostrap 3 with modals. I've a button that opens a modal, in the modal there are some facet blocks.
The view has ajax enabled, so when I click on a facet the page is not reload but are reloaded the content of the view AND facets blocks.

I've to execute some js functions when I click on facets links, I've added this js to my theme:

Drupal.behaviors.my_theme = {
    attach: function (context, settings) {
        jQuery('#facets a', context).click(function () {
            alert('enter');
        });
    }
};


The problem is that the alert is executed only on the first click. On second, third etc alert does not appear.

What's wrong?
Check to see if the ID has changed. If the content containing #facets is getting ajaxed in then the ID may have changed

Or you could try:

jQuery('body').on('click', '#facets a', function () {
        alert('enter');
    });