I have a link that changes the text into something else once it’s clicked. It’s working fine and changes when clicked but once the page is refreshed, the text reverts back to the original text.
$('a.like-link').text('Unlike');
That’s what I’m using by the way.
Is there any way to prevent the text from reverting back to the original text?
You’ll need to persist the new state somehow. You could use an AJAX request to update a database, or set a cookie, for example.