JSFiddle - React, Tailwind, and code Playground

by wirey00

HTML

<table border="1">
  <tbody>
    <tr>
      <th rowspan="3">1</th>
      <th>Nadpis</th>
      <td colspan="9">Eiusmod tempor</td>
      <td> <a href="#">zmeniť</a> 
      </td>
      <td rowspan="3"> <a class="zmenit-poziciu" href="#">zmeniť pozíciu</a> 
      </td>
    </tr>
    <tr>
      <th>Text</th>
      <td colspan="9">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam
        ...</td>
      <td> <a href="#">zmeniť</a> 
      </td>
    </tr>
    <tr class="obrazok">
      <th>Obrázok</th>
      <td colspan="9">
        <img alt="img" src="http://lorempixel.com/500/120/sports/1">
      </td>
      <td><a href="#">zmeniť</a>
      </td>
    </tr>
    <tr>
      <th rowspan="3">2</th>
      <th>Nadpis</th>
      <td colspan="9">Nim ad minim</td>
      <td><a href="#">zmeniť</a> 
      </td>
      <td rowspan="3"> <a class="zmenit-poziciu" href="#">zmeniť pozíciu</a> 
      </td>
    </tr>
    <tr>
      <th>Text</th>
      <td colspan="9">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam
        ...</td>
      <td> <a href="#">zmeniť</a> 
      </td>
    </tr>
    <tr class="obrazok">
      <th>Obrázok</th>
      <td colspan="9">
        <img alt="img" src="http://lorempixel.com/500/120/sports/2">
      </td>
      <td> <a href="#">zmeniť</a> 
      </td>
    </tr>
  </tbody>
</table>

JavaScript

$(".zmenit-poziciu").click(function () {
  var img = $(this)
            .closest('tr') // get to the tr level
            .nextAll(".obrazok:first") // find the next tr with class=obrazok
            .find('img'); // find the img
  alert(img.attr('src'));
  return false;
});