Why is passing the ClientID to a javascript function passing the entire control?
If you pass the ClientID to a javascript function as a parameter without including single quotes around it, it is passed as a reference to the control itself, which can then be used without first calling getElementByID.
I can't seem to find this behavior anywhere, is it a browser specific thing or a .net thing or what?
I am setting up a call like this in code ...
protected void Page_Load(object sender, EventArgs e)
{
Button1.Attributes.Add("onClick", string.Format("showvalue({0})", TextBox1.ClientID));
}
I am worried that this may not work in older versions of IE. Thank.
+1
source to share
2 answers