declare var bulkManagerVar; function RedNaoCreateInvoiceDropDown(selector) { let $select=jQuery(''); let first=true; for(let invoice of bulkManagerVar.invoices) { let option=jQuery(''); if(first) option.attr('selected','selected'); first=false; option.text(invoice.Name); option.val(invoice.InvoiceID); $select[0].appendChild(option[0]); } $select.insertAfter(jQuery('#'+selector)); } jQuery(function(){ if(typeof bulkManagerVar!="undefined"&&bulkManagerVar.invoices.length>1) { RedNaoCreateInvoiceDropDown('bulk-action-selector-top'); //RedNaoCreateInvoiceDropDown('bulk-action-selector-bottom'); } });