-2

i have this div

<div class="mark1">
        <img src="images/mark1.png">            
    </div>
<div class="mark2">
        <img src="images/mark1.png">
</div>

and i run this jquery when he clicks on the div

jQuery(document).ready(function($){

$('.mark1').on({
     'click': function(){
        window.location.href='reservations.html';
     }
 });
 
 $('.mark2').on({
    'click': function(){
       window.location.href='reservations.html';
    }
});

how can i add a jquery that gets a different image at the top according to the mark a user clicks (dynamically at the same page)

Bakaru
  • 1

1 Answers1

0

You can use one javascript function and call this function in different div. I think this solution is easiest for you.

<div class="mark1" onclick="openwindow();">
    <img src="images/mark1.png">            
</div>
<div class="mark2" onclick="openwindow();">
    <img src="images/mark1.png">
</div>

function openwindow(){
  window.location.href='reservations.html';
}
Dakshina
  • 65
  • 7