I write a code that will arrange me a points sinside table, but when I specific arrayOfDivs all works great: http://jsfiddle.net/u58k6/6
var arrayOfDivs = [({topPosition : 99, leftPosition: 100}),({topPosition : 150, leftPosition: 400}),({topPosition : 578, leftPosition: 10})];
When I try to dinamicly creating this arrayOfDivs based on other things, when I add this code to create arrayOfDivs:
var arrayOfDivs = [];
$("#table .draggable").each(function(index, item){
var lat = $(item).attr("lat");
var lng = $(item).attr("lng");
var top = $(this).position().top;
var left = $(this).position().left;
arrayOfDivs.push({topPosition : top, leftPosition: left, lat : lat, lng : lng});
});
var height = $('table').height();
var rowsCount = $('table tr').length;
var ROW_HEIGHT = height/rowsCount;
FINAL VERSION: http://jsfiddle.net/u58k6/10/ , I just get this error in console: Uncaught TypeError: Cannot call method 'push' of undefined
Why? What is the prob;em?