Reputation: 3618
I have a button that looks like the below:
As you can see in the image there is a black border around the <a>
aspect of the button. I added the black border. The click events are not doing anything however.
Here is my code:
$('.vbseo_like_link').each(function(){
$(this).click();
$(this).css("border", "5px solid black");
});
At the moment, when these are clicked there should be a Javascript alert
that pops up along with the button becoming faded. This works when I manually click on it, however using click()
does not seem to work.
Did I do something incorrect?
Upvotes: 0
Views: 93
Reputation: 61
$(this) is for the jquery selector, but your click is within each. I think Givi is right. Try this.click()
Upvotes: 1
Reputation: 2351
if your manual click works, you can try this.click()
.
this.click()
calls the DOM method click().$(this).click()
is more complicated (trigger jQuery click event). It does the same as $("#id").trigger("click")
.Upvotes: 2