PHP not outputting the onclick in anchor tag

I think WP is stripping the onclick out of the content. You shouldn’t really use inline onclick anyway.

Give the link an ID and then add an on click in your JS. Something like this…

jQuery('#myLink').click(function() {
    ... Your myFunction() code
});