Sortable on dynamically created elements

Created on 13 Mar 2018  路  4Comments  路  Source: SortableJS/Sortable

Hi all,

Not directly an issue, but I'm trying to get sortable working on divs I dynamically create. Any idea how to solve this? So far it doesn't seem to work.

Most helpful comment

I am not the author of this fiddle, but it does what you are looking for http://jsfiddle.net/06y0w14b/

EDIT: That's actually a complicated example with nested sortables. If you are looking for something a lot more simple, try this http://jsfiddle.net/tn0nr3b5/19/

All 4 comments

I am not the author of this fiddle, but it does what you are looking for http://jsfiddle.net/06y0w14b/

EDIT: That's actually a complicated example with nested sortables. If you are looking for something a lot more simple, try this http://jsfiddle.net/tn0nr3b5/19/

is there any way to initialize Sortable instance on element which is not present in DOM yet but will add dynamically later

@azinkey If it works on an element that is not in the DOM then yes, but if not there is no special way to make it work

Thank you @activestylus! I'm coming from 2020 and you saved my day.

Was this page helpful?
0 / 5 - 0 ratings