Musikero31
Musikero31

Reputation: 3153

Safari does not fire onmousedown fast

I just find this issue weird. I have this jquery method:

$(".UserLink").mousedown(function(event){
  if(event.which == 3)  {
    $(".UserLink").attr("href", "www.google.com");
  }
});

I also have this html code:

<a class="UserLink" href="#">
  <div>My Links</div>
</a>

What happens is that the mousedown event does not fire as fast in Safari as compared to Firefox, Chrome and IE. Therefore, the UserLink href did not change in Safari as compared to IE, Firefox and Chrome.

Is there any explanation as to why this happens?

Upvotes: 0

Views: 640

Answers (1)

Krish
Krish

Reputation: 688

Try this

$(document).ready(function () {    
    $(".UserLink").mousedown(function(event){
          if(event.which == 3)  {
            $(".UserLink").attr("href", "www.google.com");
          }
        });
    });

Instead of onmousedown cheange it to mousedown event.
Here event.which is reading the value as 1, so it will jump out of the if condition.

Upvotes: 1

Related Questions