html - how to assign multiple values to a button when loading table using javascript and json -
in below code have used json array(pedingplt) load data below html table. here each every table data has got single value. in particular table data have included button.so there possibility assign multiple values button (*********), mean using array. kindly me
function tsc_document_status_list_table_for_tsc_portal() { var tabledata; $.post("model/tscadminview.php", {action: 'tsc_document_status_list_table_for_tsc_portal'}, function (e) { if (e === undefined || e.length === 0 || e === null) { tabledata = '<tr class="error"><td colspan="4"> no data found in database </td></tr>'; $('#tsc_document_status_list_table_for_tsc_portal tbody').html('').append(tabledata); } else { $.each(e, function (index, pedingplt) { index++; tabledata += '<tr>'; tabledata += '<td>' + index + '</td>'; tabledata += '<td>' + pedingplt.document_id + '</td>'; tabledata += '<td>' + pedingplt.tsc_accepted_or_created_date +'</td>'; tabledata += '<td>' + pedingplt.total_allocated_days + ' days' + '</td>'; tabledata += '<td>' + pedingplt.expired_date + '</td>'; tabledata += '<td> <button class="btn btn-sm btn-alt m-r-5 delete_selected_employee" value="' + ******** + '"><i class="fa fa-trash-o fa-lg"></i> </button>' + pedingplt.total_quantity +'</td>'; tabledata += '<td>' + pedingplt.completed_phone_list + '</td>'; tabledata += '<td>' + pedingplt.peding_phone_list + '</td>'; tabledata += '</tr>'; }); //load json data table $('#tsc_document_status_list_table_for_tsc_portal tbody').html('').append(tabledata); } }, "json"); }
the value
attribute of button of type "text" (source), it's not possible add multiple values it.
that said, free stringify json-string in value, , parse when need it:
json.stringify()
(method documentation: json.stringify)
Comments
Post a Comment