I have a link that has onclick attribute, which unfortunately I cannot modify. What I wanna do is to call and execute another function before onclick function is called. Upon researching I figured out I cannot do that as onClick has first priority.
In order to achieve what I want here is what I want to do. Using Jquery remove onclick attribute and then add modified onclick attribute as soon as page loads.
For example: I currently have this.
<a href="#" class='myclass' onclick="Joomla.submitbutton('article.apply')">link</a>
I want to make it look like this
<a href="#" class='myclass' onclick="MyFunction(); Joomla.submitbutton('article.apply')">link</a>
That way, it will execute myfunction before default function.
I am not good with Jquery, can someone help. Thanks.