I have a JavaScript in an external page and the script reference in the master page of asp.net. I am getting an error I can not figure out.
"Now it is saying that JavaScript runtime error: Unable to set property 'onclick' of undefined or null reference."
Any tips on how to fix this would be greatly appreciated.
"Now it is saying that JavaScript runtime error: Unable to set property 'onclick' of undefined or null reference."
Any tips on how to fix this would be greatly appreciated.
Code:
$(document).ready(function () {
var myButton = document.getElementById('<%= btnsubmit.ClientID %>');
myButton.onclick = function () {
var script = document.createElement("script");
$.ajax({
url: "testmenow.aspx",
data: null,
success: function (data) {
$("#parttable").html(data);
}
});
return false;
}
});
ASP page
<div id="parttable"> </div> <asp:Button ID="btnsubmit" runat="server" Text="click me" name="btnsubmit" />
Comment