Safari browser error in jQuery / javaScript
I am having problems with Safari Browser. My table header is structured as follows:
Color Code, Color, Size, Total Box, Total Pairs
This layout works with Chrome, but when it comes to Safari, the layout is:
Total Box Total Pairs, Size, Color Code, Color
Please, help. Thank you. Here is my code.
var table = document.createElement('TABLE');
var thead = document.createElement('THEAD');
var tbody = document.createElement('TBODY');
var tr = thead.insertRow(0);
var td;
// color code header
td = tr.insertCell(tr.length);
$(td).attr('rowspan',2);
$(td).text('Code');
//color name header
td = tr.insertCell(tr.length);
$(td).attr('rowspan',2);
$(td).text('Color');
//color size header
td = tr.insertCell(tr.length);
$(td).attr('colspan',season.Size.length);
$(td).text('Size');
//color total pairs header
td = tr.insertCell(tr.length);
$(td).attr('rowspan',2);
$(td).text('Total Pairs');
//color total box header
td = tr.insertCell(tr.length);
$(td).attr('rowspan',2);
$(td).text('Total Box');
+3
source to share
1 answer
This is not a problem in the Safari browser. You have a mistake in your code tr.length
that doesn't actually return the length, it does undefined
. Thus, the order can be different across browsers.
http://jsfiddle.net/6mgu6goj/5/
Cause
tr.length
+1
source to share