iterating through folders
html, iteration, javascript
Solution
This line
src = "../Filepath/[i]/" + pageName + "-" + (i+1) + "." + ext;
supposed to be
src = "../Filepath/[" +i + "]/" + pageName + "-" + (i+1) + "." + ext;
Problem
I have a list of items all of which are wrapped with a div, and each item is inside a `<p>` tag. I need to add an ``` <a href="../Filepath/Followed by, in numerical order, 7.html ---> all the way through infinity. ``` So for instance if I have 100 items all with a ``` <p> ``` tag, then I want a matching number of ``` <a href> ``` tags to be generated. I thought a loop would be a nice solution, but cant come up with the scheme to make it work. I did start on the code, and this is what i have come up with so far. Keep in mind that I am storing all the html files in a folder which I access via the script. All of which are numbered from 7 ++ ... HTML ``` <div class="container"> <p>Textual description of item</p> ... </div> ``` Javascript ``` $(document).ready(function() { var files = {'.html':100}; var pageName = ""; var html = "", src; for (var ext in files){ for (var i = 0; i < files[ext]; i++){ src = "../Filepath/[i]/" + pageName + "-" + (i+1) + "." + ext; html += '<a href="'+src+'"></a>'; } $("container").prepend(html); }}); ``` (The script is not finished, so feel free to alter it completely if you have a better approach