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

  • Home
  • SEARCH
  • 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 7088487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:48:25+00:00 2026-05-28T07:48:25+00:00

I am having an issue trying to create a re-useable function for setting up

  • 0

I am having an issue trying to create a re-useable function for setting up elements as either draggable or droppable.

Creating 2 separate functions for this works:

makedroppable($('.empty_child_article_image'), handleChildDropEvent);

or

makedraggable($('.empty_related_article_image'), handleAlternativeDragEvent);


function makedroppable(droppableClass, specificHandler){   
  droppableClass.droppable( {
    drop: specificHandler,
    hoverClass: 'hovered'
  });  
};

or

function makedraggable(droppableClass, specificHandler){   
      droppableClass.draggable( {
        drop: specificHandler,
        hoverClass: 'hovered'
      });  
    };

This however does not work:

makedroppable($('.empty_child_article_image').droppable, handleChildDropEvent);

    function makedroppable(dragordrop_func, specificHandler) {
       dragordrop_func({
       drop: function(){specificHandler.apply($ ,specificHandler)},
       hoverClass: 'hovered',
     }); 
    }

And I get an error for “dragordrop_func({” with this error in my console

Object [object DOMWindow] has no method ‘each’

I have tried a number of other solutions and from what i’ve read this should work. What am I doing wrong?

Any help or guidance is welcome.

Thank you

  • 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-05-28T07:48:25+00:00Added an answer on May 28, 2026 at 7:48 am

    The this object reference is lost when you pass $('.empty_child_article_image').droppable as an argument to the function. Inside function makedroppable -> this will be the window object and not your $('.empty_child_article_image') object.

    And so the error is thrown because the this object points to window object and not the $('.empty_child_article_image') inside droppable function.

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

Sidebar

Related Questions

I'm trying to create a basic shopping cart, having an issue with the product
I am having an issue converting type. I was trying code like this (minimal,
I'm having a weird issue with a function I'm trying to call from within
I am having an issue trying to create a table for a website I
I am having an issue when trying to create beans from a spring Application
I seem to be having an issue creating an AlertDialog. What I am trying
I'm having a workflow issue with my JQuery dialogs when trying to create the
I am having an issue with this site - http://thestamp.umd.edu/canvastest/test.html I'm trying to build
Im having a small issue today.. I am trying to create an aui as
Hi I seem to be having an issue trying to align an H1 tag

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.