JSFiddle - React, Tailwind, and code Playground

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/dot-luv/jquery-ui.css">
<input type="text" id="datepicker" />

<button id="myButton">Open</button>

JavaScript

var toBeInsertedToAS = [], theSetDataCount = 0;

for(j=1;j<=10;j++)
{
    $('<img />').one('load', function(){                
                 toBeInsertedToAS.push(this.src);
                 if(toBeInsertedToAS.length == theSetDataCount)
                     alert(toBeInsertedToAS.join('|'));
              }).attr('src','http://dummyimage.com/10x1' + j + '/000/fff')
                .each(function() {
                  if(this.complete) $(this).load();
              });
    theSetDataCount++;
}