Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Jecy Maynard
Courses Plus Student 217 Pointsjquery: store urls into an array and open them using .click(); function with next, previous, random controls
My Exlanation of what I am trying to do
create an empty class in HTML like so:
<div class="resources"></div>create an array of URLs in JAVASCRIPT/JQUERY and store them within .resources class
create prev , random , next buttons in HTML
random button when clicked opens random URL from array i.e.:
$(array[random]).click();next button when clicked opens next URL from array i.e.:
$(array[+1]).click();prev button when clicked opens previous URL from array i.e.:
$(array[-1]).click();
MUSTS: urls must be opened with: click(); function: like so: $(array[0]).click();
fiddle to make it clearer: view http://jsfiddle.net/2my5mmno/
thank you for your time
2 Answers
Erwin Meesters
15,088 PointsI'm not sure how it's going to work for you. What should happen when you click on next for example? Link to another page? Do you mean something like this?: example link
Jecy Maynard
Courses Plus Student 217 Pointsyes, something like that. I solved it already though ;)