0

JavaScript does not work after you add new elements ? add more later, but I want you to work for elements how to track down a road I do not know Example;

$(".ui-draggable").draggable();    
$('body').append('<div class="ui-draggable"></div>');
Djizeus
  • 4,161
  • 1
  • 24
  • 42
Hasan
  • 309
  • 1
  • 3
  • 17

1 Answers1

2

Because .draggable() is not dynamic.

Do this:

$(".ui-draggable").draggable();    
$('body').append($('<div class="ui-draggable"></div>').draggable());

Your first line attaches only the elements which were present in the DOM.

It will not check for dynamically added ones.

Amit Joki
  • 58,320
  • 7
  • 77
  • 95