Reputation: 1239
I have an grid. Chessboard to be specific. All the squares have numbers from 0 to 63. What I need to do, is to get number of square that piece is currently on, and pass it to the server, where all game logic is handled.
Chessboard is made of divs.
My question is how to get that number ?
Upvotes: 0
Views: 100
Reputation: 30496
Set css classes on the divs, for example
<div class="col_25 row_11">
then it would become quite easy to extract these css class from the parent div of your piece, see for example this response to extract the classes of th div Get class list for element with jQuery , and then you should be able to extract the int coordinate from the classes names.
Upvotes: 1