In DTM, the onClick handler is created for you when you create an event rule.
This all happens in the Conditions section of the rule:
Note the event type is "Click" and the Element Tag or Selector is set to "a" indicating that I want to set up a listener for any click on any anchor tag. You can be as specific or as lax in the CSS selector that you put into this field.
In the Actions part of the rule (Adobe Analytics in this case), we can set variables.
Below you'll see two examples.
1) In the AA custom link name, I am using the static text, "Clicked on Anchor - " and using data element syntax "%%" to wrap a reference to the event variable which is always available for DTM event rules. In this case, I'm pulling the text of the anchor tag by specifying %event.target.text%.
2) For eVar11 I am simply grabbing the href of the anchor tag using %event.target.href%