php - Jquery,working fine in Chrome, but not in Firefox and Safari -
a simple list sort function. function sorts list items recent date (data-date attribute). in chrome works fine in firefox , safari nothing. no errors in firebug :s.
$( document ).ready(function() { $('#november ul li').sort(function(a,b){ homecoming new date($(a).data('date')) < new date($(b).data('date')); }).each(function(){ $('#november ul').prepend(this); }) });
who can tell me i'm doing wrong? thanks.
got solution. before sorting need utilize method toarray(). why chrome works without adding of toarray code , firefox & safari not, beats me. final code this.
$( document ).ready(function() { $('#december ul li').toarray().sort(function(a,b){ homecoming new date($(a).data('date')) < new date($(b).data('date')); }).each(function(){ $('#december ul').prepend(this); }) });
thanks helping!
php jquery google-chrome firefox safari
No comments:
Post a Comment