I want to get diff Controls Id through java script??any control can be added by user on form java script will return the type of Control for ex textbox,label and its ID
views:
22answers:
1
+1
A:
By controls, I'm assuming you mean form input controls. To get the id of an element, you can call .getAttribute('id')
on an object. To get the type of a form element, access the 'type` attribute.
For example, if you want the id
attribute and type of an input in the first form on a page, where the input has the name
attribute "title":
var titleInput = document.forms[0].getElementsByName('title')[0];
alert("id = '" + titleInput.getAttribute('id') + "'\ntype = '" = titleInput.type + "'");
Tyson
2009-03-17 07:00:42
Tyson this was great
2009-03-19 06:44:45
You should mark my answer as "Accepted" :)
Tyson
2009-03-19 19:55:56