Set variable name to clicked element name


#1

How can I set a variables value to the name of an element I click?
Thanks.


(Greg) #2

The simplest way would be…

var x = element.id

alert(x)