I'm trying to pass the results from foreach to <span id="mostra_ref">
to the mouse click, however this is only passing the last explode function value, inside the foreach . I need to show each reference clicked.
<div class="entry-summary">
<span id="mostra_ref"><?php echo @$referencia_1 ?></span>
//primeiro mostra um valor do banco de dados
//ao clicar em qualquer referência na classe sku imprime apenas F015
</div>
<div class="product-variations">
<ul class="variations list-unstyled">
<?php
$aux = explode(",", $referencia);
foreach($aux as $outras_refs) : ?>
<li>
<div class="thumbnails">
<a class="zoom">
<script type="text/javascript">
$('a').on('click',function(){
$('#mostra_ref').html('<?php echo $outras_refs; ?>');
});
</script>
<div class="sku"><?php echo$outras_refs; ?></div>
//IMPRIME F014,F013,F015
</a>
</div>
</li>
<?php
endforeach;
?>
</ul>
</div>