Search code examples
javascriptjqueryjquery-uijquery-ui-plugins

jQuery UI - when should I use destroy method on the widgets


When I attach functionality to an element do I need to call .widgetName('destroy') before removing it from the DOM or does jQuery handle this?


Solution

  • Try using remove .

    I don't think this happens automatically, but then again, I don't think you need to call the destroy method as the event handlers are destroyed for you from the remove call.