Home > other >  can not render values of array (jquery)
can not render values of array (jquery)

Time:03-29

hey i can not render all my values. i got names (button) if i click these i will render the array behind it. if i use .append() it will render all of them but when i click again it wil not refresh it and get stacked. what i want use is something like .text() or .html(). but i can not find the issue it wil return always the first one in the array and the other values are not showing.

 var treinen =$("#treinenArray0");
    var list = data.info[0].kwalificaties;
    $.each(list, function(index, value){
       treinen.html($('<li>'  value   '</li>'));
    });

CodePudding user response:

You seem to be not appending them but instead overwriting them.

treinen.html(treinen.html()   '<li>'  value   '</li>'));

should append each one to the pre-existing html.

  • Related