I am trying to replace a text link with a spinner on click. I have this:
$(document).on('page:fetch', function(e) {
$('.spinner').replaceWith( "<img src='<%= asset_path('layout/spinner.gif') %>'>" );
});
But it is obvious that all links with the .spinner class gets the spinner. I want to replace only on the clicked link and only IF it has the spinner class.
Any suggestions?