jquery table offsetWidth question -
i have been looking hours , can't figure out.
trying write code align table headers , table columns,
trying figure out overall width of header cell , width of column.
strange reason tdoffset
gets value , thoffset
nan
.
$("#tbltasks tbody tr:eq(0) td").each(function(index) { tdoffset = parseint(this.offsetwidth); thel = $('#tbltasks thead tr:eq(0) th:eq(' + index.tostring() + ')').first(); thoffset = parseint(thel.offsetwidth); alert('tdoffset' + tdoffset + ' thoffset:' + thoffset); }
can point out doing wrong?
thanks , happy.
the reason this.offsetwidth
works , thel.offsetwidth
not this
refers dom element , thel
refers jquery object.
you can access dom element "behind" thoffset doing following
thel[0].offsetwidth
Comments
Post a Comment