I've actually solved this problem before in a different application, but my solution there doesn't seem to work here for some reason.
I have this in an aspx file:
I have a designer class in which the button is declared (and therefore exists in the server-side codebehind):
var b = document.getElementById("<%=SaveButton.ClientID%>");
<asp:Button ID="SaveButton" Text="save" OnClientClick="myfun()" ClientIDMode="Static" runat="server" UseSubmitBehavior="False" />
But when I click on my button, the alert box says "null".
protected global::System.Web.UI.WebControls.Button SaveButton;
Some things to note:
*The button exists within a content tag:
*I'm working within Visual Studios 2008.
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">