Get all href attributes of dynamic links inside dynamic div stored in array

Get all href attributes of dynamic links inside dynamic div stored in array

I've a few dynamic elements being generated on click of a button. 
On click of this button, I get dynamic divs generated which also contain link.

I get only the first href attribute value("link0.com") in the array "linkArr".

How do I get all of the href attributes stored inside this array?

Here's my code.

  1. <!DOCTYPE html>
  2.     <html>
  3.         
  4.         <head>
  5.             <meta charset="UTF-8">
  6.             <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  7.             <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.css">
  8.             <style>
  9.      .parent {
  10.      height: 25%;
  11.      width: 90%;
  12.      padding: 1%;
  13.      margin-left: 1%;
  14.      margin-top: 1%;
  15.      border: 1px solid black;
  16.     
  17.      }
  18.     
  19.      .parent:nth-child(odd){
  20.      background: skyblue;
  21.      }
  22.     
  23.      .parent:nth-child(even){
  24.      background: green;
  25.      }
  26.     
  27.     
  28.      </style>
  29.         </head>
  30.         <body>
  31.             <button class="btn btn-primary" onclick="getData()">Get data</button>
  32.     
  33.      <div class="box">
  34.     
  35.             </div>
  36.      <script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
  37.      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  38.      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  39.      <script>
  40.     
  41.      var content = "";
  42.     
  43.      linkArr = new Array();
  44.     
  45.      function getData(){
  46.      var count = 0;
  47.      for(count=0; count<5; count++) {
  48.      content+= '<div class="container-fluid parent"><div class="row"><div class="col-md-6">Number: '+count+'</div><div class="col-md-6"><a href="link'+count+'.com" class="mylink">Link'+count+'</a></div></div></div>';
  49.     
  50.      }
  51.     
  52.      $('.box').html(content);
  53.     
  54.     
  55.      $('.box').each(function(){
  56.      linkArr.push($(this).find('.mylink').attr('href'));
  57.      console.log(linkArr);
  58.      });
  59.      }
  60.     
  61.      </script>
  62.      </body>
  63.      </html>