JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="first" value="ID first">
<input type="text" id="second" value="ID second">
JavaScript
$('#first').insertAfter('#second');
// или
// $('#second').insertBefore('#first');