0

I have a timer. I want one but could use to Start/Pause/Resume. Here is the code

Is it something like

  toggleButton.click(function(){
    if (){
      Clock.start();
      self.click(function(){
        Clock.pause();
      });
    } else if (){
      Clock.pause();
      self.click(function(){
        Clock.resume();
      })
    } else{
      Clock.resume();
      self.click(function(){
        Clock.pause();
      })
    }
  });

It seems working, but I get error in Firebug:

TypeError: self.click is not a function

self.click(function(){

1
  • 2
    What is self ?? u want $(this) ?? Commented Feb 15, 2014 at 11:10

1 Answer 1

3

Fiddle Demo

replace self with $(this)

Read this keyword

Sign up to request clarification or add additional context in comments.

2 Comments

And, do I code the function is js way? I fear that I'm too verbose.
@cqcn1991 yes code can be optimized start learning more api.jquery.com and learn.jquery.com :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.