Steve
Steve

Reputation: 4908

What is the default behavior for a mousedown?

I came across some code that explicitly prevents the default behavior for a mousedown event. I'm wondering what the default behavior might be for a mousedown and why you would want to prevent it.

   .on('mousedown.minicolors', '.minicolors-grid', function (event) {
      var target = $(this); 
      event.preventDefault();
      $(document).data('minicolors-target', target);
      move(target, event, true);
   }) 

Thanks

Upvotes: 1

Views: 1298

Answers (1)

jfriend00
jfriend00

Reputation: 708046

The default behavior depends upon what the object is.

We could answer more specifically if you showed the relevant HTML that goes with the code and perhaps a little more of the code so we could see what objects the code is acting on.

In addition, calling preventDefault() doesn't hurt anything even if there is no default behavior.

Upvotes: 2

Related Questions