Render two lists by commas in a bootstrap element by js

0

I do not know how old-fashioned this is ... or that you recommend me to do about it, but I have two lists separated by commas

  

122,1,3,1,1,2,2,1

and

  

EMPLOYEES, ANALYST OF ACCOUNTS PAYABLE, GENERAL ASSISTANT, BECARIO, DEVELOPER BI, DIRECTOR, COMMERCIAL DIRECTOR, DIRECTOR

I need to put both in a single List Group bootstrap, I do not know if it's more convenient to turn it into a json or something to make it work better ...?

function RenderizarT_A(lb, d) {

   var table = $("#renderizando");
                    $.each(lb, function (rowIndex, r) {
                        var row = $("<li class='list- group - item'>");

                        var campoA = lb[rowIndex];


                        row.append($("</li>" + campoA));


                        table.append(row);
                    });

}
<div class="container">
  <h2>List Group With Badges</h2>
  <ul class="list-group" id="renderizando">

  </ul>
</div>

    
asked by E.Rawrdríguez.Ophanim 16.04.2018 в 18:14
source

1 answer

1

Try this:

var table = $("#renderizando");

$.each(l2, function(rowIndex, ele){

  var row = "<li class='list-group-item' value= "+l1[rowIndex]+"> "+ele+" </li>";

  table.append(row);

});

Where l2 is the list of names and l1 the list with the Ids.

I hope it helps you.

    
answered by 17.04.2018 / 15:06
source