F
F
FANTASANTA2020-04-27 20:27:47
JavaScript
FANTASANTA, 2020-04-27 20:27:47

Why doesn't the loop create multiple buttons?

We need the loop to add all the buttons according to the array:

$.each(data, function(key, video) {
      console.log('link:'+video.link+' quality:'+video.quality);
      $('.block').html('<a href="'+video.link+'" class="btn btn-primary">'+video.quality+'<br/><small>('+video.size+')</small></a>');
});


As you understand, data is an array. Everything works fine with console.log(). But several buttons should be inserted into $(.block) . And only one is inserted. What's the matter?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question