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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:26:36+00:00 2026-06-17T00:26:36+00:00

Until recently I had this set up, which was called multiple times: $(‘.rsh’) .draggable(‘destroy’)

  • 0

Until recently I had this set up, which was called multiple times:

                $('.rsh')
                    .draggable('destroy')                               
                    .draggable({ blah blah details });

The destroy was there to stop multiple draggable handlers accumulating on the class. New elements are being created by AJAX, and an initial attachment of draggable to the class doesn’t touch subsequently created elements.

However, when I updated to version 1.9.2 of jQuery UI, it started giving me this error:

Error: cannot call methods on draggable prior to initialization; attempted to call method ‘destroy’

So I removed the destroy line, and it’s sweet. Except… I suspect that I may now be adding more and more handlers to the class (which is why the destroy was there in the first place).

I tried this, but it didn’t like it:

if ($('.rsh').length) {
    $('.rsh').draggable('destroy'); 
}

Two questions: (1) Will there be more and more handlers attached to the class each time I fire the draggable set up line? (2) If so, any solutions on how to remove them?

  • 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-17T00:26:38+00:00Added an answer on June 17, 2026 at 12:26 am

    No, there won’t be extra handlers bound. jQuery registers the initialized instance to the element and won’t create a new instance of the same widget for the same element.

    As you’re worried about handlers, here’s a quick check (jQuery 1.8+ and UI 1.9+):

    $('div').draggable();
    console.log( $._data($('div')[0], 'events') );
    $('div').draggable();
    console.log( $._data($('div')[0], 'events') );
    

    Fiddle

    As you can see, the attached handlers object is not altered after trying to initialize a new draggable instance on the same element.

    edit: Subsequent calls with parameters won’t be ignored though, rather they will extend the existing widget as shown on @Jason Sperske’s answer.

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

Sidebar

Related Questions

I have a simple object called Entry , which until just recently only had
Recently I had this question , and everything worked properly until I sent it
I am working with an existing bespoke ecommerce platform which until recently had no
Until recently, I had a bunch of virtual sites set up like so: <VirtualHost
I had until recently been under the impression that the CDbl(x) operation in VB.NET
until recently , for too large apps (50+ MB apps) you had to use
In ASP.NET we have until now only had one theme, which was specified in
I had never tried Continuum as a build server until recently when a project
Up until recently I had a working service using NHibernate 2.0. I have upgraded
Up until recently, I had been using Safari 4 for testing and debugging my

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.