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