$("[data-toggle=tooltip]").tooltip("dispose"); <% # Remove the modal if it already exists %> $("#edit_bookmark_modal").remove(); $("#new_bookmark_modal").remove(); <% # Create and show the modal %> $("body").append("<%= j render('edit_bookmark_modal', bookmark: @bookmark) %>"); $("#edit_bookmark_modal").modal("toggle");