I have a behavior that adds on to some checkboxes.
(function($) { Drupal.behaviors.mymodule = { attach: function (context, settings) { $('.skip-line', context).on('change', function(){ // some code if ( confirm(Drupal.t('Apply to all languages?')) ) { // applying... } }); } }; })(jQuery); It works very well, but checkboxes are in AJAX-loaded part. If I reload that part of the form, clicking on them makes confirmation popup twice. Now, I know I can test inside function if it's the first time in a row it's called, but I would prefer to make sure it is added to my element only once, and thus called only once. How can I do that?