I'm using a sortable with a table that I created. And what I want is to be able to get the div class name that contains the element that I dropped.
Here's my html:
<div class="@c.CodigoAgrupador">
<div class="subcatalog">
@foreach (CodigoAgrupadorCuentas_CE c2 in Model.CodigosAgrupadores)
{
if (double.Parse(c2.CodigoAgrupador) > double.Parse(c.CodigoAgrupador) && double.Parse(c2.CodigoAgrupador) < (double.Parse(c.CodigoAgrupador) + 1))
{
<h4><a href="#">@c2.CodigoAgrupador - @c2.NombreCuenta</a></h4>
<div>
<div class="SpecificCatalog">
<ol>
<li class="placeholder">Add your items here</li>
</ol>
</div>
</div>
}
}
</div>
<div class="GeneralCatalog">
<ol>
<li class="placeholder">Add your items here</li>
</ol>
</div>
</div>
And here's part of my script:
<script>
$(function () {
$("#catalog").accordion({
collapsible: true,
active: false,
autoHeight: false,
change: function (event, ui) {
var currentHeaderID = ui.newHeader.find("a").attr("id");
window.alert(currentHeaderID);
}
});
$(".subcatalog").accordion({
collapsible: true, active: false, autoHeight: false,
change: function (event, ui) {
var currentHeaderID = ui.newHeader.find("a").attr("id");
window.alert(currentHeaderID);
}
});
$(".GeneralCatalog").sortable({
connectWith: ".SpecificCatalog, .listaCatalogosContenido", helper: "clone",
appendTo: "body",
stop: function (event, ui) {
//console.log((this).sortable('toArray', { attribute: 'value' }));
console.log(ui.item);
//$("div#catalog h3 a").each(function (item) {
// alert($(this).text());
//});
}
});
});
</script>
What I'm interested in, is that when I call the stop function, from jquery, I can use the ui.item
to get class name of the div that contains it, something like:
ui.item.parent.getclassname();
I don't want to know if the element is within a class, I want to know the class name. Sorry if it is hard to understand, my english is not the best. Any help is welcome.