Advertisement
Virajsinh

Minify Code For jQuery to HTML

Sep 16th, 2024 (edited)
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.93 KB | Source Code | 0 0
  1. var internal_supplier_list = @json($internal_supplier_list); // JSON Encode Data Laravel
  2.  
  3. // Internal Supplier List :: BEGIN
  4. var $select_internal_supplier = $(`<select class="form-control form-control-sm aiz-selectpicker" data-id="${uniqueId}" name="orders[${uniqueId}][internal_supplier_id]"></select>`);
  5. var $defaultOption = $('<option></option>').attr('value', '').text('-- Select --');
  6. $select_internal_supplier.append($defaultOption);
  7. $.each(internal_supplier_list, function(index, item) {
  8.     var $option = $(`<option></option>`).attr('value', item.user_id).text(item.name);
  9.     $select_internal_supplier.append($option);
  10. });
  11. // Internal Supplier List :: END
  12.  
  13. var orderRowHTML = `
  14.                     <tr>
  15.                         <input type="hidden" data-id="${uniqueId}" name="orders[${uniqueId}][product_id]" value="0">
  16.  
  17.                         <td>${$select_internal_supplier.prop('outerHTML')}</td>
  18.                     </tr>
  19. `;
  20.  
  21. $('#product_table tbody').append(orderRowHTML);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement