Search Results

Search found 1 results on 1 pages for 'user1656447'.

Page 1/1 | 1 

  • JavaScript closures in for-loop

    - by user1656447
    As explained here http://www.mennovanslooten.nl/blog/post/62/ code below outputs result just for "5x5" forgetting about anything before that. for (x = 1; x <= 5; x++) { for (y = 1; y <= 5; y++) { var cords = x+"x"+y; var el = document.getElementById(cords); el.addEventListener("click", function (e) { B_modeWindow('1', cords); }); } } As far I have the informations (blog link provided above) can't figure out how to alter showed code to fix it. How to walk around this code with JavaScript closure in my for-loop?

    Read the article

1