I have a table
<table>
<tr>
<td><div class="line_1 div_1" line='1' number='1'></div></td>
<td><div class="line_1 div_2" line='1' number='2'></div></td>
<td><div class="line_1 div_3" line='1' number='3'></div></td>
<td><div class="line_1 div_4" line='1' number='4'></div></td>
<td><div class="line_1 div_5" line='1' number='5'></div></td>
</tr>
<tr>
<td><div class="line_2 div_1" line='2' number='1'></div></td>
<td><div class="line_2 div_2" line='2' number='2'></div></td>
<td><div class="line_2 div_3" line='2' number='3'></div></td>
<td><div class="line_2 div_4" line='2' number='4'></div></td>
<td><div class="line_2 div_5" line='2' number='5'></div></td>
</tr>
<tr>
<td><div class="line_3 div_1" line='3' number='1'></div></td>
<td><div class="line_3 div_2" line='3' number='2'></div></td>
<td><div class="line_3 div_3" line='3' number='3'></div></td>
<td><div class="line_3 div_4" line='3' number='4'></div></td>
<td><div class="line_3 div_5" line='3' number='5'></div></td>
</tr>
</table>
And what I need is. With jQuery function, which demo is here ->http://jqueryui.com/selectable/ I need to create prety simmilar function.
I simply have an 3x5 array in js and when I select the divs, it changes numbers in this array.
-- pseudocode --
var tab = new Array();
tab[1] = new Array(0,0,0,0,0,0);
tab[2] = new Array(0,0,0,0,0,0);
tab[3] = new Array(0,0,0,0,0,0);
if( $('div').isSelected() ){
tab [$(this).attr('line')] [$(this).attr('div')] = 1;
}
In the demo after you selected the divs, it changed the background.
Here, I would have the array with 0 and 1 if it was selected or not
When I tried the .selectable() from the demo, all page started to loop, although I have jquery 1.9.1. Thanks for the help.