JSFiddle - React, Tailwind, and code Playground
JavaScript
var newButton = document.createElement('button');
newButton.id = 'newbutton';
newButton.innerHTML = 'button_test';
document.body.appendChild(newButton);
var forExample = document.getElementById('newbutton');
alert(forExample.offsetWidth);