0

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..

Sandeep Thomas
  • 4,303
  • 14
  • 61
  • 132

2 Answers2

0

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'));
Sandeep Thomas
  • 4,303
  • 14
  • 61
  • 132
0

try this it worked in my case

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

Shubham
  • 443
  • 2
  • 10