There is a table that the user fills. At the end of each line you need to get some result. I want to understand how to make javascript work within a single current line? And how can I get it the line number?
<table border="1"> <tr> <th>Товар</th> <th>Цена за кг</th> <th>Количество</th> <th>Стоимость</th> <th>Расчитать</th> </tr> <tr id="row0"> <td id="good0">Яблоки</td> <td><input id="price0" type="text"></td> <td> <select id="qty0"> <option value="0">-</option> <option value="1">1</option> <option value="2">2</option> </select> </td> <td id="cost0">0</td> <td><button onclick="jsfunc()">OK</button></td> </tr> <tr id="row1"> <td id="good1">Груши</td> <td><input id="price1" type="text"></td> <td> <select id="qty1"> <option value="0">-</option> <option value="1">1</option> <option value="2">2</option> </select> </td> <td id="cost1">0</td> <td><button onclick="jsfunc()">OK</button></td> </tr> </table> There is another idea to assign each cell id in the format (row number, column number) id="12" , for example. But how to tell it via the button?