I cannot trigger this click on this element
$(this).find('.views-field-field-cover-fid').find('a.imagecache-coverimage').click();
The jQuery path is correct. Indeed if I print it, it gives the correct a element:
console.log($(this).find('.views-field-field-cover-fid').find('a.imagecache-coverimage'));
But for some reason the function click() doesn’t work on it.
thanks
EDIT:
Now I see that you want to visit the
hrefof theaelement.Do this:
Patrick, the
.click()function behaves differently depending upon how it is used.If you are hoping to fire a ‘click’ event handler for the element you selected, then you are using it correctly, but first you will need to give some functionality to that element.
That brings us to the second (and more common) way in which
.click()is used. That is to give functionality to an element. Run this when the DOM loads:Now all elements that match your selector will show the alert when clicked, or when you trigger the event like you did originally.