get element id using javascript





Is there a way to get, using javascript, the id of an html element?but automatically store in a variable the id of the element that is triggering the function? I been trying, and I was able to do it in a form, using a submit button will check every field but I am naming the ids id1, id2, id3, etc. where If you have a text input box with ID age and you want to obtain the value for the text box via JavaScript use the JavaScript function getElementById() to get the value.