سؤال

I am working with one jquery for sort div using its row and column attribute.

See this fiddle

> See below fiddle link

Fiddle

This will work fine with Firefox and it will not work with chrome.

Can you please let me know what is the problem in this?

Thanks in advance.

هل كانت مفيدة؟

المحلول

Finally i got my answer.

$('#swappable > span').sort(function (a, b) {
  var ar = a.getAttribute("row");
  var ac = a.getAttribute("col");
  var br = b.getAttribute("row");
  var bc = b.getAttribute("col");

  if(ar > br)
  {
    return ar > br;
  }

  if(ar === br)
  {
    if(ac > bc)
    {
      return ac > bc;
    }
  }

}).appendTo('#swappable');

Please check below Fiddle

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top