JSFiddle - React, Tailwind, and code Playground
HTML
<style type="text/css"><!--
.spn { color:blue; font-weight:bold; }
--></style>
<script type="text/javascript"><!--
$(document).ready(function() {
var new_btn = $('<button id="btn">Click</button>'); // new button
var new_span = $('<span>START</span>').addClass('spn'); // new <span> with class="spn"
new_btn.insertAfter('#idd'); // insert the new button after the tag with id="idd"
// now we use the new added button, when is clicked
$('#btn').click(function() {
// insert the "new_span" at the beginning inside all DIVs with class="cls"
new_span.prependTo('div.cls');
});
});
--></script>
<div class="cls"> Create and insert new HTML items with jQuery</div>
<div class="cls" id="idd"> coursesweb.net</div>