JSFiddle - React, Tailwind, and code Playground
HTML
<p id="foo">
</p>
JavaScript
var inp = document .createElement ('input');
inp .pattern = '^\d+\.?\d*$';
document .getElementById ("foo") .appendChild (inp);
<p id="foo">
</p>
var inp = document .createElement ('input');
inp .pattern = '^\d+\.?\d*$';
document .getElementById ("foo") .appendChild (inp);