Tom
Tom

Reputation: 12998

Trigger the click event of asp.net linkbutton on mouseenter using jQuery

I am trying to trigger a click event on hover using jQuery.

This is pretty simple but it would seem I can not trigger the click of an asp.net linkbutton which refreshes the content of an updatepanel using this method.

Here's the code - fairly standard so not sure it will make a difference.

$("a.testbutton").mouseenter( function() {
    $(this).trigger('click');
});

Any ideas?

Upvotes: 1

Views: 863

Answers (2)

Riaan Walters
Riaan Walters

Reputation: 2676

Have you tried

$("a.testbutton").mouseenter( function() {
    $(this).click(function(alert();)) //replace alert(); with your refresh function
});

Upvotes: 0

Ram
Ram

Reputation: 144689

Programmatically triggering click differs from actual click event, try the following.

$("a.testbutton").mouseenter(function() {
    window.location.href = this.href
});

Upvotes: 3

Related Questions