Javascript Tab Gallery with Advanced Custom Fields

Fixed it!

This is the resulting code:

<?php 

$images = get_field('extra_photos');

if( $images ): ?>
<div class="row2">

<?php foreach( $images as $image ): ?>
    <div class="column2" >
    <img src="https://wordpress.stackexchange.com/questions/337143/<?php echo $image["url']; ?>" alt="https://wordpress.stackexchange.com/questions/337143/<?php echo $image["alt']; ?> " onclick="myFunction(this);"/>
    </div>
<?php endforeach; ?>    

</div>
<!-- The expanding image container -->
<div class="container2">
  <!-- Close the image -->
  <span onclick="this.parentElement.style.display='none'" class="closebtn">&times;</span>

  <!-- Expanded image -->
  <img id="expandedImg" style="width:100%">

  <!-- Image text  --> 
  <div id="imgtext"></div>
</div>


<?php endif; ?>