Reputation: 97
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?
Upvotes: 0
Views: 72
Reputation:
Two options;
Doing it server side
Useful links:
Doing it with cookies
Useful links:
Upvotes: 1
Reputation: 17434
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.
Upvotes: 2