Php Php
Php Php

Reputation: 127

jQuery .mousedown() and .click()

I have a div. There is an image in that div. mousedown() method is attached to that div. On the other hand .click() method is attached to that image.

When I click on the image the .mousedown() method start working. But I would like to stop that .mousedown() and start .click() method . How can I do that ??

Thanks

Upvotes: 1

Views: 3118

Answers (1)

A. Wolff
A. Wolff

Reputation: 74420

This is what i understand you want to do:

$('img').mousedown(function(e){
  e.preventDefault();
  $(this).trigger('click');
});

Upvotes: 2

Related Questions