What is stored in variable cols in : var $cols = $(‘.sortdivs’).on(‘click’,function(){…});

The return value from .on is simply the collection that it was called on, for chaining purposes.

$cols, therefore, is the jQuery object containing a list of elements matched by $('.sortdivs') at the time of exection (NB: not at the time of click).

[object Object] is the string representation of any object. Try to inspect the object in another manner, for instance by using console.log($cols) to be able to get more information of just the output of a simple toString().

Leave a Comment