How to stop the jquery element being added on ajax requests I've added a toggle for my superfish menu, it works fine but for every ajax load or colorbox trigger the span is created multiple times. How to fix it???

(function ($){
Drupal.behaviors.customjs  = {
attach: function (context, settings) {
$(document).ready(function(){


$("#superfish-1").before("&lt;span class='toggle'&gt;Menu&lt;/span&gt;");
$('#superfish-1').toggle();
 });
The better way would be to use the context of the behaviour along with .once() as mentioned here ( https://www.drupal.org/node/1667874 ), something like below:

(function ($){
  Drupal.behaviors.customjs  = {
    attach: function (context, settings) {
      // Add context along with .once something like below.
      $("#superfish-1", context).once("CLASS-NAME").before("&lt;span class='toggle'&gt;Menu&lt;/span&gt;");
    }
  }
})(jQuery);