My event is never being fired, and I can not figure out owhy. Here is my syntax
<asp:Button id="btnone" runat="server" visible="false" OnClick="btnone_Click" />
<script type="text/javascript">
$( document ).ready(function() {
var button = document.getElementById('btnone').click();
}
});
And for my C# code behind
protected void btnone_Click(object sender, EventArgs e)
{
Response.Write("It was clicked through JS");
}
EDIT I have also tried to use this code to capture the ClientID of the button but it's not working
$( document ).ready(function () {
$('<%= btnone.ClientID %>').click();
}
});