Getting element by passing string in javascript
ASP.NET
2
Posts
2
Posters
0
Views
1
Watching
-
Hi, In javascript is it possible to get the element by passing the string variable. Is there any way to do this.(I want to get it by passing a string variable only) Example. var ElementName ="ComboBox1"; this.form.getElementById(ElementName); Regards, Chakravarthy.v
-
Hi, In javascript is it possible to get the element by passing the string variable. Is there any way to do this.(I want to get it by passing a string variable only) Example. var ElementName ="ComboBox1"; this.form.getElementById(ElementName); Regards, Chakravarthy.v
As long as the your element's
id
attribute is set (for example, to "ComboBox1") then you can usevar e = document.getElementById("ComboBox1");
to retrieve it in javascript.