0

I'm trying to add DOM element with using JQuery in that way:

 $("<label/>", {

    "class": "switch",  

       on:{

          click: function(event){

          let currentBlock =  $(this).parents('.item');

          if($(this).find('input[type=checkbox]'){
            currentBlock.toggle('inactive')
          }
          else{
            currentBlock.toggle('inactive')              
          }
      },

      append: '<input type="checkbox"><span class="slider round"></span>',

      appendTo: context

  }); 

And it work like a charm, but I can append to this block only one element.

I mean that piece of code:

append: '<input type="checkbox"><span class="slider round"></span>'

I tried to find in which way I can add a few elements, put theare Array or Object...but it does not work :(

Anyone has similar problem?

Re_p1ay
  • 303
  • 1
  • 3
  • 12

0 Answers0