I have the following script in a Web Forms project:
function myScriptInAspxFile() {
var obj = document.getElementById("<%= TextBox1.ClientID %>");
if (obj) {
obj.value = "My Text";
}
}
this works fine when I put the script inside the Web forms aspx file, but when I change the script to a Js (JavaScript) file the line:
var obj = document.getElementById("<%= TextBox1.ClientID %>");
The assignment returns me a null value for the obj variable. How could I find a control from a script in a Js (JavaScript) file? Greetings and thank you in advance.