Topic: MD Draggable Plugin: Attach draggable event to dynamically created card
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;
};
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
Open
Specification of the issue
- User: 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
Tags
Related topics
Magdalena Dembna staff premium commented 5 years ago
Can you share your entire code including calling
.draggable()
function? It would seem that yournewCard
has not been initialized properly.