Question

In this example: http://jsfiddle.net/ga89T/10/

I have 3 Sections (section 1, section 3 and section 3). In this example you can try, when I sort the sections, the function sortable("toArray") returns the order of those sections.

Now I would like to get the order of such sections with class="current".

I tried the following:

$("#accordion.current").sortable("toArray"); 

but it returns [object object]

How can I select certain sections to be sorted?

Was it helpful?

Solution

First, you should use the descendant operator because the sortable itself doesn't have a .current class. Second, you may be better off using the .map function: http://jsfiddle.net/ga89T/12/.

var order = $("#accordion .current").map(function() {
    return this.id;
}).get();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top