JSFiddle - React, Tailwind, and code Playground
HTML
<script src="//platform.linkedin.com/in.js"></script>
<div id="scripts-go-here"></div>
JavaScript
addScript = function (counterPosition) {
mainElement = document.getElementById("scripts-go-here");
d = document.createElement("script");
d.type = "IN/Share";
console.debug(d.type);
d.setAttribute("type", "IN/Share");
console.debug(d.getAttribute("type"));
d.setAttribute("data-counter", counterPosition);
// Reset the current element, since we only want to change the layout of the button
while (mainElement.firstChild) {
mainElement.removeChild(mainElement.firstChild);
}
mainElement.appendChild(d);
console.debug(mainElement);
IN.parse(mainElement);
};
addScript("right");
setTimeout(function () {
addScript("top");
},
2500);