Is working fine on Chrome, could someone tell me why it isn't sorting the table on Safari and how to fix it?
I've looked the console, there's no error.
HTML:
<tr>
<td>
<input name="d1" value="01/01/1992">
</td>
</tr>
<tr>
<td>
<input name="d1" value="01/01/1991">
</td>
</tr>
</tbody>
</table>
<button>SORT</button>
jQuery:
$('button').on('click',function(){
sort();
});
function sort() {
$('tBody tr').sort(function(a, b) {
return new Date($(a).find('input[name="d1"]').val()).getTime() > new Date($(b).find('input[name="d1"]').val()).getTime()
}).appendTo('tBody');
}
JsFiddle:
http://jsfiddle.net/nm5vbtdq/1/