Exercise 14/16, Don't want to change text permanently



I don't want to change my text permanently when clicked. I want to go back to my previous text when again clicked. So which code should I use?


This lesson calls for a permanent change. Anything otherwise would require you to define a variable stating if it was opened or closed, and acting upon it as such, which you don't need to worry about for this lesson.


I'm not worried. I just wanted to know how to do that. Can you please show me an example?


Sorry for the late response. Here's one method you could use for this purpose:

var open = false;

function main() {
  $('.projects-button').on('click', function(){
    if (open){
      $(this).text('Recent Projects');
      open = false;
      $(this).text('Projects Viewed');



aha! cool! Thank dude!


This topic was automatically closed after 7 days. New replies are no longer allowed.