I have the following HTML:
<div class="nestedQuestionGroup">
<div class="formsection">
</div>
<div class="formsection">
</div>
</div>
<div class="nestedQuestionGroup">
<div class="formsection">
</div>
<div class="formsection">
</div>
</div>
<div class="nestedQuestionGroup">
<div class="formsection">
</div>
<div class="formsection">
</div>
</div>
How can I make #nestedQuestionGroup
sortable and not the childs within It? The current sortable-function from jquery-ui makes the child sortable, not the parent itself.
From based documentation on jqueryui sortable widget ( http://api.jqueryui.com/sortable/ ), you should try to do this :
html :
<div id="parent-sortable">
<div class="nestedQuestionGroup">
<div class="formsection">
</div>
<div class="formsection">
</div>
</div>
<div class="nestedQuestionGroup">
<div class="formsection">
</div>
<div class="formsection">
</div>
</div>
<div class="nestedQuestionGroup">
<div class="formsection">
</div>
<div class="formsection">
</div>
</div>
</div>
js :
$( "#parent-sortable" ).sortable({
items: "> .nestedQuestionGroup"
});
You can personalize your sortable with many options like delay, cursor, opacity, axis, classes, etc...
Hope it helped !
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.