You can simply use the event.target property to get the class from any element which is clicked on the document in jQuery. In this solution there is no need to know the element beforehand.
Let's try out the following example to understand how it basically works:
Use the
targetPropertyYou can simply use the
event.targetproperty to get the class from any element which is clicked on the document in jQuery. In this solution there is no need to know the element beforehand.Let's try out the following example to understand how it basically works:
need an explanation for this answer? contact us directly to get an explanation for this answer