JSFiddle - React, Tailwind, and code Playground

by Dave Salomon

HTML

<button>Foo</button>

JavaScript

$(document).ready(function () {
     function Test() {
        var that = this;
        that.testFunc = function() {
            //alert('i will also fire when this.testFunc() is called.');
        }
        
        // alert('i will fire');
        this.testFunc();
     }  
    
    $('button').click(function(){
       Test(); 
    });
});