js05 to jQuery

by Professor Tom DeDonno

HTML

<div id="lightbox">
We need to creat inside elements
</div>

JavaScript

var e = { /* key: value */
"lbCounter" : null,  "lbPrev" : null,
"lbNext" : null,   "lbPlay" : null,
"lbImages" : null };
/* book is creating 5 objects lbCounter..lbImages
   will will be using an associatiive */

function createLightBox( ) {

	   alert( "In createLightBox" );

     let lightBox = $( "#lightbox" );
     let lbTitle = $( "<h1></h1>" );
     lbTitle.attr( "id", "lbTitle" );
     lightBox.append( lbTitle );
     
     for( var key in e ) {  
     		e[key] = $( "<div></div>" );
        console.log( key + ": " + e[key] );
        lightBox.append( e[key] );
        e[key].attr( "id",  key );
        e[key].text( "Created:" + key );
        }
}

$( document ).ready( function() {
createLightBox( );
}