JSFiddle - React, Tailwind, and code Playground

by ethagnawl

HTML

<div id='foo'>foo</div>

JavaScript

window.SaveResponseHandler = function(el, type) {
        var that = this;

        if (!type) {
            this.success = function() {
                that._success();
            };
        } else if (type == window.SAVE_TYPE_DESTROY) {
            this.success = function() {
                that._success();
                $(el).remove();
            };
        }
    };

    SaveResponseHandler.prototype._success = function(model, response, options) {
        alert('foo')
    };

s = new SaveResponseHandler(document.getElementById('foo'), false).success()