download I am trying to tri" /> download I am trying to tri" /> download I am trying to tri"/>

Linkbutton click event not firing via JQUERY

427 views Asked by At

I have a link button on page which is rendered like this in html

<a id="lb_download" href="javascript:__dopostback...">download</a>

I am trying to trigger the click event of that button using JQUERY

$('#lb_download').click();

But its not firing. Direct clicking is working fine with the button. but using JQUERY is not

What I did wrong

Adding little more details I tried a jquery event handler for the click event if firing or not

$('#lb_download').click(function(){
alert(10);
});

The weird part is its working and the alert is showing, but the post back or server side travel is not happening.. which happens when we click directly..

2

There are 2 answers

0
Sandeep Thomas On

Im able to solve the issue using eval as follows since the server side call is not occuring when using click() method of jquery.

eval($('#lb_download').attr('href'));
0
Shubham On

try this it worked in my case

document.getElementById('lb_download').click();