I need some help in the accordion tab functionality where by I need to display the specific content of that accordion tab on the right side of the form. I have all accordion on the left side of the form.
Here is the code that I am working on HTML and JS:
$(document).ready(function() {
// activate Nestable for list 1
$('#nestable').nestable({
group: 1
})
.on('change', updateOutput);
// output initial serialised data
updateOutput($('#nestable').data('output', $('#nestable-output')));
$('#nestable-menu').on('click', function(e) {
var target = $(e.target),
action = target.data('action');
if (action === 'expand-all') {
$('.dd').nestable('expandAll');
}
if (action === 'collapse-all') {
$('.dd').nestable('collapseAll');
$('.content:visible').slideUp();
}
});
$(function() {
var nestablecount = 2;
$('#appendnestable').click(function() {
$('ol.outer').append('<li class="dd-item dd3-item" data-id="' + nestablecount +
'"><div class="dd-handle dd3-handle">Drag</div><div class="dd3-content" name="' + nestablecount + '">Item ' + nestablecount + '</div><div id="c-' +
nestablecount + '" class="content"><form role="form-' + nestablecount +
'"><div class="form-group"><label for="name">Name</label><input type="text" class="form-control" id="name" placeholder="Phyllis Wheatley"></div><div class="form-group"><label for="name">Add a Description</label><textarea class="form-control" rows="3" placeholder="Quite the poet"></textarea><div class="checkbox"><label><input type="checkbox" value="">Now you know it ;)</label><button type="submit" class="btn btn-default btn-xs pull-right">Yes</button></div></div></form></div></li>'
);
updateOutput($('#nestable').data('output', $('#nestable-output')));
nestablecount++;
});
});
}
});
<div class="col-lg-6">
<div class="card">
<div class="card-body">
<div id="wrapper">
<div class="panel-group" id="accordion">
</div>
<div class="dd" id="nestable">
<ol class="dd-list outer">
<li class="dd-item dd3-item" data-id="1">
<div class="dd-handle dd3-handle">Drag</div>
<div class="dd3-content" name="1">
Item 1
<span class="label label-default">New
</span>
</div>
</li>
</ol>
</div>
<div id="nestable-menu">
<button type="button" class="btn btn-default" id="appendnestable">
<i class="fa fa-magic"></i>
Add
</button>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-6">
<p><pre id="nestable-output"></pre></p>
</div>
What i am seeking help is that on the nestable-output i need to show something like
Clicked tab 1, if i clicked on the ITEM 1, and so on.
Here is the jsfiddle
Here is a reference that I want to achieve:
