My code is below, and as the title explains the script is only working in chrome. I've tested some things and IE is having no problem with getting the elements or their dates, the problem lies with the sort function. Any ideas how to fix this?
Thanks
<script>
jQuery(document).ready(function () {
var elems = jQuery.makeArray(jQuery(".column.half"));
elems.sort(function(vara, varb) {
return new Date( jQuery(vara).attr('datetime')) > new Date( jQuery(varb).attr('datetime'));
});
jQuery(".row.listing").html(elems);
});
</script>
Here is the jsfiddle which also only works in chrome:
I can't answer yet because I'm a newbie but I'll paste it here for now to save people time:
FIGURED IT OUT!!!!!!!!!! Wow that was frustrating, hopefully I can save some people a few hours of their lives and some gray hairs...
The problem was that the sort function was returning 'true' or 'false'. But for the sort function here's what return is expecting: -1 means the first one is less 0 means the two are equal 1 means the first is greater
Apparently Chrome is the only browser that converted the boolean. So all I had to do was change the return from Boolean true/ false to 1/ 0