Q:

EmberJS: Jquery datepicker stays active when changing routes

I have an emberjs web app where one of my views is a search page to query a database of records. I have the ability to filter by date and am using JQuery's datepicker.
The problem I am having is that if a user opens the datepicker and then hits either the browser back or forward button it stays active on the screen until a user clicks away. To clarify the process is as below: 

Navigate to search page
Click select date
Datepicker appears
User clicks the browsers back button
Previous page loads BUT with datepicker still lingering around 

Does anyone have any suggestions of how to hide or destroy the datepicker when a browsers back button is pressed? 
Thanks!!
EDIT----------------------------
Current code: 
Formal.Route.Search = Ember.Route.extend({
    deactivate: function () {
        console.log("hi");
        $("ui-datepicker-div").datepicker("destroy");

    },

A:

Put the removal logic at View instead Route. Lets assume your template name is "search", then
App.SearchView=Ember.View.extend({
    didInsertElement:function(){
       $("#ui-datepicker-div").datepicker();
    },
    willDestroyElement:function()){
       $("#ui-datepicker-div").datepicker("destroy");
    }
});

Note: I assumed your selector is ID, if it is css class then use $(".ui-datepicker-div")
If you would like to write datepicker as component which can be used across the application then do watch the Screencast here http://eviltrout.com/2014/06/03/jquery-component.html
P.S. If you still could not figure out, please show your code in http://jsbin.com/ 

