JSFiddle - React, Tailwind, and code Playground

by Mohamed Amer

HTML

<select id="lc_currency1">
<option>Select1</option>
</select>
<select id="lc_currency2">
<option>Select2</option>
</select>
<select id="lc_currency3">
<option>Select3</option>
</select>


<form id="lc_change1">
<button>
Just test form 1
</button>
</form>
<form id="lc_change2">
<button>
Just test form 2
</button>
</form>
<form id="lc_change3">
<button>
Just test form 3
</button>
</form>

JavaScript

$(document).ready(function(){
     jQuery('select[id^=lc_currency]').each(function(){
          var getformId = $(this).attr('id').replace('currency','change');
          $(this).insertAfter('form#'+ getformId);
     });
 });