JSFiddle - React, Tailwind, and code Playground

HTML

<span class="asssociateClass">Name:</span><input id="name" type="text" />

JavaScript

$('span.asssociateClass').each(function() {
  var l = $("<label class='associateClass' />")
           .html($(this).html())
           .attr('for', $(this).next(":input").attr("id"));
  $(this).replaceWith(l);
});