A simple example of what I am trying to achieve:
$('.test-link').click(function(e) {
e.preventDefault();
alert($(this).attr('href'));
});
$('.test-form').submit(function(e) {
e.preventDefault();
$(this).append('<a href="testing" class="test-link">Click here</a>');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form class="test-form">
<input type="submit">
</form>
When the form is submitted it successfully creates the link with the class "test-link" which has a function ready to handle the click. When clicked I need to trigger the existing function, in this exemple it should alert "testing", but the link works as a regular link.