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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:09:08+00:00 2026-06-05T02:09:08+00:00

Whenever a user presses a div button I want to register a droppable. I’m

  • 0

Whenever a user presses a div button I want to register a droppable. I’m setting a the closure
add.droppable({}) to the var toDrop and then invoking methods on toDrop as below, is this a bad practice ?

For example instead of toDrop.addClass("newColors"); should I be using something like

this.addClass("newColors")

Here is the complete snippet :

$("#myDiv").on('click' , '.colors' , function() { 
    var add = $(this).parent();
        var toDrop = add.droppable({
            drop: function(event, ui) {
            toDrop.addClass("newColors");
            toDrop.attr("portletName", parameter);
        }
    });  
}); 
  • 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-05T02:09:09+00:00Added an answer on June 5, 2026 at 2:09 am

    Unless you want to use that variable tpDrop other than in the drop handler it is advisable to use this keyword instead of a creating a closure which represents the droppable element.

    So you should be using $(this).addClass("newColors");

    You can make use of jQuery chaining feature.

    $(this).addClass("newColors").attr("portletName", parameter);

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

Sidebar

Related Questions

In Moose , I want my browser to be notified whenever a user presses
Basically my aim is to have this timer reset whenever the user presses button
So I want to trigger an event (pausing/unpausing some media) whenever the user presses
I want to start an activity indicator whenever the user presses any link on
I am trying to record whenever a user clicks on Facebook Like button. Facebook
I am developing an app whenever a user add some details the record get
I'm currently using the following code to produce an image whenever the user presses
My application is a C# Windows form application. When the user presses the button
I have the code below to open a new window whenever user presses F2
I have a textbox and whenever the user presses a key it's checked to

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.