JSFiddle - React, Tailwind, and code Playground

by Ravinder Bhardwaj

HTML

<script src="https://appsforoffice.microsoft.com/lib/1/hosted/Office.js"></script>

JavaScript

Office.initialize = function (reason) {
    // Checks for the DOM to load using the jQuery ready function.
    $(document).ready(function () {
    // After the DOM is loaded, add-in-specific code can run.
    // Display initialization reason.
    if (reason == "inserted")
    write("The add-in was just inserted.");

    if (reason == "documentOpened")
    write("The add-in is already part of the document.");
    });
}

// Function that writes to a div with id='message' on the page.
function write(message){
    document.getElementById('message').innerText += message; 
}