javascript - Jquery loop coding -


i have problem jquery loop. not stopped after reach 10th element, display 10 times every element. don't know problem. must add counter (z) after if clause, because want display 10 elements of filtered items (i if must not filter elements).

the part of code:

 function(data) {        $.each(data.query.results.tbody, function (i, e) {  .. ... .... ......      if (x != '-') {         var z;         (z = 0; z < 10;) {             $(".news").append('xxxxx');             z++         }     }              });   }  ); 

var temp=''; (z = 0; z < 10; z++) {     temp += "xxxx"; } $(".news").append(temp); 

append var outside loop. creare var temp, append data , after loop completes, post append: https://learn.jquery.com/performance/append-outside-loop/


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -