خرید بک لینک

Vote count: 0

How would access all the div's that have been linearly declared through jquery. Here I am trying to make loop through them using a variable 'l'. And it holds the class name.

<html>
<div class="t0"></div>
  <div class="t1"></div>
<div class="t2></div>
  <div class="t3"></div>
  <div class="t4"></div>
</html>
<script>
    var holder = ["cretetion", "OgamingSC2", "ESL_SC2", "FreeCodeCamp", "pewdiepie"];
var holderName;
for (var i = 0; i < holder.length; i++) {
  holderName = holder[i];
  var url = "https://api.twitch.tv/kraken/streams/" + holder[i] + "?callback=?";

  $.getJSON(url, function(data) {
      var l = ".t" + i;
      console.log("Value of l is " + l);

      $(l).html("<button class='btn btn-primary'>" +holderName+"</button>");


  });
}
</script>

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: يکشنبه 15 فروردين 1395 ساعت: 20:51

صفحه بندی