I have a variable in javascript:
var activeSearchButton = document.getElementById('<%=btnSearch.ClientID %>');
I want to set it like this:
<asp:TextBox ID="WFTo" runat="server" onchange="activeSearchButton = document.getElementById('<%=btnWFSearch.ClientID %>');"></asp:TextBox>
When I am trying to use the varible in javascript function, it is null. And the source shows:
onchange="activeSearchButton = document.getElementById('<%=btnSearch.ClientID %>');"
I noticed ‘& lt;’ instead of “<“. Is this the reason of my problem? Why does this happen? Or maybe there is another reason?
Thank you very much.
Just create a function in
<script />sectionand use
EDIT:
As it turns out, you cannot use
<%= .. %>for server side controls. You’ll have to resolve to using a regular html input like thisand
or leave the
<asp:TextBox />as it is and on Page_Load do