Hi everyone,
I would like to add a new feature to my website. I have several links that are redirected when click over them to another page, but instead using <a>
elements I am using “onclick” feature in a div.
I could use the following code in an <a>
element to make it work:
target="_blank"
But as I was saying, I am using the feature “onclick” in a <div>
. Is there any way to do it this way?
Here is an example of what I have:
<?php foreach ($Blacks as $DWG): ?>
<div class="miniescaparate" onclick="location.href = 'single.php?ID=<?php echo $DWG['ID'] ?>'">
<img src="caratulas/<?php echo $DWG['thumb'] ?>" alt="<?php echo 'Carátula para el juego ' . $DWG['titulo'] . ' de Xbox One' ?>" title ="<?php echo $DWG['titulo'] ?>"/>
<p class="descuento">-<?php echo number_format($DWG['descuento_DWG'],0) ?>%</p>
<p class="titulo"><?php echo $DWG['titulo'] ?></p>
</div>
<?php endforeach; ?>
Thanks in advice.