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 9206577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:12:19+00:00 2026-06-18T00:12:19+00:00

I am trying to assign event handlers to my buttons in an array. When

  • 0

I am trying to assign event handlers to my buttons in an array. When I press the button, it should call a function but just doesn’t and can’t figure out why.
Here is my code:

var btns = [];
    btns.push($('<div />').addClass('mvn_no mvn'));
    btns.push($('<div />').addClass('mvn_n mvn'));
    btns.push($('<div />').addClass('mvn_ne mvn'));
    btns.push($('<div />').addClass('mvn_o mvn'));
    btns.push($('<div />').addClass('mvn_c'));
    btns.push($('<div />').addClass('mvn_e mvn'));
    btns.push($('<div />').addClass('mvn_so mvn'));
    btns.push($('<div />').addClass('mvn_s mvn'));
    btns.push($('<div />').addClass('mvn_se mvn'));
    for ( var i = 0; i < btns.length; i++) {
        btns[i].mousedown(function() {
            moveImage(this);
        }).mouseup(function() {
            clearTimeout(tMovement);
        }).mouseout(function(){
            clearTimeout(tMovement);
        });
        table.find('td:eq(' + i + ')').append(btns[i]);
        $($options.expose.elementMovement).empty().append(table);

    }
    alert($._data( $("div.mvn_so"), "events" ));

Once this piece of code runs, I click on the buttons and nothing happens. I even tried calling a dummy function that only had an alert in it and it still doesn’t work. I also tried to get the event on a given element and it returns undefined. Any help is appreciated.

  • 1 1 Answer
  • 0 Views
  • 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-06-18T00:12:20+00:00Added an answer on June 18, 2026 at 12:12 am

    So, after hours of debugging, I finally found the culprit that was breaking my code. It was the goddamned .empty()
    on $($options.expose.elementMovement).empty().append(table); when I removed it, the code worked just fine. I have no idea why it didn’t work as it was but I am glad it works now. Even putting the empty in separate line breaks my code.

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

Sidebar

Related Questions

I've been trying to assign a function to onclick event of a dynamically created
I am trying to assign an array to a marker in the javascript function
I am currently trying to assign an event handler to dynamically created rectangle objects.
I am trying to assign a regular expression result to an array inside of
i have a menu item, and i'm trying to assign its OnClick event handler:
I'm trying to set an array collection equal to a event.result that contains an
I'm trying to assign an event listener to a dynamically loaded anchor tag. The
I am trying to assign an change event to an element. I have var
I am trying to add a button inside a jqGrid column and to assign
Im trying to assign an onKeyUp event to all inputs within a form, using

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.