There is a span whose class corresponds to the class of the hidden div, which contains the image.
When you click on a span corresponding div appears.
The script looks like this:
<script> $( "span.123" ).click(function() { $( "div.123" ).fadeToggle(function() { }); }); </script> And to be more precise, in the code instead of 123 there is a php code that displays the desired value:
<?php the_field('number_1'); ?> Those. the whole code looks like this:
<script> $( "span.<?php the_field('number_1'); ?>" ).click(function() { $( "div.<?php the_field('number_1'); ?>" ).fadeToggle(function() { }); }); </script> The problem is that span.<?php the_field('number_1'); ?> span.<?php the_field('number_1'); ?> and div.<?php the_field('number_1'); ?> div.<?php the_field('number_1'); ?> can be up to 30 pieces.
The value of the class can contain both numbers and Latin alphabetic characters.
The final html looks like this:
<div id="wrapper"> <span class="random_nubmer_1"></span> <span class="random_nubmer_2></span> <span class=" random_nubmer_3></span> <!--И так далее...--> </div> <div id="wrapper_2"> <div class="random_nubmer_1"></div> <div class="random_nubmer_2></div> <div class=" random_nubmer_3></div> И так далее... </div> When you click on <span class="random_nubmer_1"></span> , <div class="random_nubmer_1"></div> displayed, and the rest are hidden.
Question : how to combine all 30 pieces in one code?
I attach a schematic example of what I want to get: 
If possible, please explain with comments.

<div id="wrapper"> <span class="random_nubmer_1"></span> <span class="random_nubmer_2></span> <span class="random_nubmer_3></span> <!--И так далее...--> </div> <div id="wrapper_2"> <div class="random_nubmer_1"></div> <div class="random_nubmer_2></div> <div class="random_nubmer_3></div> И так далее... </div>When you click on<span class="random_nubmer_1"></span><div class="random_nubmer_1"></div>displayed and the rest are hidden. - Frontendman