Revision: 47576
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 10, 2011 05:56 by arpit
Initial Code
var elems = document.getElementsByTagName( 'a' ); for ( var i = 0; i < elems.length; i++ ) { (function( lockedInIndex ){ elems[ i ].addEventListener( 'click', function(e){ e.preventDefault(); alert( 'I am link #' + lockedInIndex ); }, 'false' ); })( i ); }
Initial URL
http://benalman.com/news/2010/11/immediately-invoked-function-expression/
Initial Description
Initial Title
Locking index while looping
Initial Tags
Initial Language
JavaScript