In the case you are asking about, this represents the HTML DOM element.

So it would be the <a> element that was clicked on.

Answer from TM. on Stack Overflow
🌐
W3Schools
w3schools.com › jsref › event_onclick.asp
onclick Event
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › API › Element › click_event
Element: click event - Web APIs | MDN
addEventListener("click", (event) => { }) onclick = (event) => { } A PointerEvent. Inherits from MouseEvent. Note: In earlier versions of the specification, the event type for this event was a MouseEvent. Check browser compatibility for more information. This interface inherits properties from ...
🌐
QuirksMode
quirksmode.org › js › this.html
Javascript - The this keyword
Each time the function is called, this refers to the HTML element that is currently handling the event, the HTML element that "owns" the copy of doSomething(). ... you do not copy the function! Instead, you refer to it, and the difference is crucial. The onclick property does not contain the actual function, but merely a function call:
🌐
freeCodeCamp
freecodecamp.org › news › html-button-onclick-javascript-click-event-tutorial
HTML Button onclick – JavaScript Click Event Tutorial
August 16, 2021 - We do this by assigning it a class of open in the else block, which makes it show the rest of the article. Then we set the class to an empty string (none) in the if block, which makes it return to the initial state. Our code is working fine with a smooth transition: We can separate the HTML and JavaScript and still use onclick, because onclick is JavaScript.
🌐
Tabnine
tabnine.com › home › how to use the onclick dom event with javascript
How to Use the onclick DOM Event with JavaScript - Tabnine
July 25, 2024 - The code above adds an event listener to myButton, which stores a reference to the element that we wish to receive events on. With this action, the button object is now “listening” – waiting to “hear” a click on that specific button – and will invoke the greet method when that event occurs. ... Note: the event above is defined as ‘click’, not ‘onclick’!
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-onclick-event
JavaScript onclick Event - GeeksforGeeks
August 8, 2025 - There is a in-bulit method addEventListener() provided by JavaScript to attach events with the HTML elements. It takes the name of the event and the callback function as arguements to attach them. selectedHTMLElement.addEventListener('eventName', callbackFunction); Example: The below code implements the addEventListener() method to applying the onclick function.
🌐
CodePen
codepen.io › beck410 › pen › BaweLZ
js - onclick = function(this)
example of how to access element the onclick method refers to...
🌐
Nickmccullum
nickmccullum.com › javascript-onclick-events
How to Use JavaScript onclick Events | Nick McCullum
You can use the onclick() event, which is a very popular event in JavaScript. It allows you to execute code when a user clicks an element on a webpage (such as a button). In this article, I will teach you how to use JavaScript onclick events to make your webpages more interactive.
🌐
SitePoint
sitepoint.com › blog › javascript › javascript ‘this’ and event handlers
JavaScript 'this' and Event Handlers — SitePoint
February 12, 2024 - <p><a id="link" href="#" onclick="return EventHandler(this);">click me</a></p>
🌐
Codedamn
codedamn.com › news › javascript
onclick function in Javascript- full guide 2022
September 21, 2022 - In HTML: <element onclick=”myScript”> In JavaScript: object.
🌐
Javatpoint
javatpoint.com › javascript-onclick-event
JavaScript onclick event - javatpoint
JavaScript onload In JavaScript, this event can apply to launch a particular function when the page is fully displayed. It can also be used to verify the type and version of the visitor's browser. We can check what cookies a page uses by using the onload attribute.
🌐
Career Karma
careerkarma.com › blog › javascript › javascript onclick: a step-by-step guide
JavaScript Onclick: A Step-By-Step Guide | Career Karma
December 1, 2023 - The JavaScript onclick event executes a function when you click on a button or another web element. For instance, an onclick event can trigger a dialog box to appear when you clock on a button.
🌐
W3Schools
w3schools.com › tags › ev_onclick.asp
HTML onclick Event Attribute
HTML DOM reference: onclick event ❮ HTML Event Attributes ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: [email protected] · If you want to report an error, or if you want to make a suggestion, send us an e-mail: [email protected] · HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial
🌐
React
legacy.reactjs.org › docs › handling-events.html
Handling Events – React
We generally recommend binding in the constructor or using the class fields syntax, to avoid this sort of performance problem. Inside a loop, it is common to want to pass an extra parameter to an event handler. For example, if id is the row ID, either of the following would work: <button onClick={(e) => this.deleteRow(id, e)}>Delete Row</button> <button onClick={this.deleteRow.bind(this, id)}>Delete Row</button>
🌐
Edureka
edureka.co › blog › onclick-in-javascript
Onclick In JavScript | Onclick Event Attribute In JavaScript | Edureka
February 25, 2025 - This event occurs when the user clicks on an element. It runs a specified line of code when you click an HTML object that has the onclick attribute. Its functions can be triggered by object.onclick or object.addEventListener.