Topic: MD Draggable Plugin: Attach draggable event to dynamically created card

arjunpr free asked 4 years ago


I have added a draggable card dynamically using jquery. However, it is not draggable. How do I make it work?

var newCard = '<div id="draggable-snap-5" class="draggable-snap card">'
      +'<div class="handle ui-draggable"></div>'
      +'<h5 class="card-header primary-color white-text" contenteditable="true" onclick="$(this).focus();">TRAVIS meets P. O.</h5>'
      +'<div class="card-body" >'
      +'<p class="card-text changeable" contenteditable="true" onclick="$(this).focus();">TRAVIS meets a the Personnel Officer. Character is introduced.</p>'
      +'</div>';

  function addNewCard() {
    $(newCard).hide().appendTo("#mycol-2").show(100);
    return false;
  };

Magdalena Dembna staff commented 4 years ago

Can you share your entire code including calling .draggable() function? It would seem that your newCard has not been initialized properly.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Opened

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.8.4
  • Device: Laptop
  • Browser: Google Chrome
  • OS: Fedora 29
  • Provided sample code: No
  • Provided link: No