Ok, Solved!
I was able to fix the JavaScript problem. I just replaced the part of "$ (this)" with this code "$ ('a', this) .last ()" in the attribute 'Href' . Thanks a lot for the suggestion.
To check my Minimal Demo is: https://codepen.io/oabart/pen/MWbPvGq