/* showing codes in an iFrame */ // locates the anchor tag and defines the event type $( '#job1 article span:first-of-type > a' ).mouseenter(function( event ){ // Disables the click event. If JS is disabled, this will be ignored anyway. $(this).click(function(e){e.preventDefault();}); // appends an iFrame whose style was set in the CSS file $(this).append( "" ); // Although no visible event occurs thanks to CSS codes, // this script keeps inserting the same file on every mouseover event // the code below stops it $( this ).off( event ); }); /* NOTES * mouseover fires when the pointer moves into the child element as well, * while mouseenter fires only when the pointer moves into the bound element. * https://api.jquery.com/mouseover/ */