0

Is there a quick way in javascript to select the element that called the function on an event such as onmouseover or onclick or do i have to use standard document selection in the method to select the element.

3 Answers 3

1

this

element.onclick = function () {
    // this == element
    // e.g. this.className = 'Highlighted';
}
Sign up to request clarification or add additional context in comments.

Comments

1

check out this?

Comments

0

If I understand your question right then you should be able to use the "this" keyword.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.