JSFiddle - React, Tailwind, and code Playground

HTML

<script src="//cdnjs.cloudflare.com/ajax/libs/phaser/2.0.6/phaser.min.js"></script>
<a href="#" id="reset">RESET</a>
<div id="phaser-example"></div>

JavaScript

// Global game
var game;

function generateGame() {
    game = new Phaser.Game(300, 300, Phaser.AUTO, 'phaser-example', {create: create});

	function create() {
		console.log('create()');
        
        // Sprite image "test" is not defined, but we do not care
        // Phaser use a default image
        var test = game.add.sprite(100, 100, 'test');
        test.inputEnabled = true;
        test.input.enableDrag(false, true);
	};
}

$("#reset").click(function(){
    
    // Destroy the game
    game.destroy(); // Destroy Phaser game
    $("#phaser-example").html(''); // Remove Canvas tag
    
    // Generate game
    generateGame();
});

// Generate game the first time
generateGame();