Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1107025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:52:43+00:00 2026-05-17T01:52:43+00:00

$(‘#start’) executes the function myFunction() and $(‘#stop’) end it. How do I stop myFunction()

  • 0

$('#start') executes the function myFunction() and $('#stop') end it. How do I stop myFunction() from executing?

function myFunction() {
     $(document).mousemove(function(e) {
          $('#field').html(e.pageY)
     });
}


$('#start').click(function() {
    myFunction();
});


$('#stop').click(function() {
   //stop myFunction
});
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:52:44+00:00Added an answer on May 17, 2026 at 1:52 am

    As Daniel pointed out, you actually want to unbind the event handler. You can use unbind for this:

    $('#stop').click(function() {
        $(document).unbind('mousemove');
    });
    

    But this will also remove all other mousemove event handlers, that might be attached by other plugins or similar (I mean, you attach to the document element not a “custom” element, so it can be that other JavaScript code also binds handlers to this element).

    To prevent this, you can use event namespaces. You would attach the listener with:

    function myFunction() {
         $(document).bind('mousemove.namespace', function(e) {
              $('#field').html(e.pageY);
         });
    }
    

    and unbind:

    $('#stop').click(function() {
        $(document).unbind('mousemove.namespace');
    });
    

    This would only remove your specific handler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I downloaded PostgreSQL from the official website and ran the .dmg installer. After that
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
i got an object with contents of html markup in it, for example: string
I am currently running into a problem where an element is coming back from
I need a function that will clean a strings' special characters. I do NOT
I have the following tasks in my deploy.rb namespace :unicorn do desc stop unicorn
I have just tried to save a simple *.rtf file with some websites and
I would like to count the length of a string with PHP. The string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.