0

hey why i get one value off 3 if i use .html(), and why if i use append() it shows all 3. but i want use .html() bequase i want the values to be changed/refresh when i use the another button.

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

do i forgot something or do you have some documantation about this that i can lern

UGC61
  • 35
  • 1
  • 6
  • `.html` sets the entire innerHTML to what you put inside the parentheses, `.append` adds whatever you put to the end of the innerHTML. You can run`.html("")` before the loop then `.append` with your stuff to make it work how you want – Samathingamajig Mar 27 '22 at 21:54
  • [_“When `.html()` is used to set an element’s content, any content that was in that element is completely replaced by the new content.”_](//api.jquery.com/html#html2). So you want a different [DOM manipulation method](//api.jquery.com/category/manipulation). – Sebastian Simon Mar 27 '22 at 21:54

0 Answers0