I have an element with an ID of BaseGridView
in my HTML. If I call a function directly on it, everything works, but if I get that element via document.getElementById()
my function call doesn't work.
For example:
BaseGridView.DoSomething();
Everything works fine for me.
But if I do this:
var hd = document.getElementById("HiddenforMainViewID");
var z = document.getElementById(hd.value);
z.DoSomething();
Nothing works and Firefox says "TypeError: z.DoSomething is not a function". The value of hd
is "BaseGridView"
, and z is an actual element.
Can someone please explain to me why this won't work?
EDIT:
Since there is confusion how this:
BaseGridView.DoSomething();
Can even work, I really have no clue. I'm using DevExpress and somehow it is able to do such things. I've been referring to this example.