When I have this in the page markup it works fine:
<script type="text/javascript">
function bought1()
{
var s = '<%= Button2.ClientID %>';
var v = document.getElementById(s);
v.click();
}
</script>
But when I have the same thing in a separate file, even though the function is executed - the value of v
remains null
.
I tried with a simple div
and it did find the div
.
Why doesn't it find the ASP.net Button?
EDIT
I even added ClientIDMode="Static"
to the Button. No change.