JSFiddle - React, Tailwind, and code Playground
HTML
<div style="display:block;overflow:hidden;" class="insertdownload" id="download-1234">Insert</div>
<input type="text" size="25" name="myplugin_new_field" id="my_new_field" value="">
<input type="text" size="25" name="z" id="format" value="1">
JavaScript
jQuery('.insertdownload').click(function($){
var test = '1234';
//var did = jQuery(this).attr('id');
//did=did.replace('download-', '');
$('input:#my_new_field').val(test);
//window.parent.tb_remove();
});