Use jquery to create a multidimensional array
- by Simon M White
I'd like to use jquery and a multidemensional array to show a random quote plus the name of the individual who wrote it as a separate item. I'll then be able to use css to style them differently. The quote will change upon page refresh.
So far i have this code which combines the quote and the name and person who wrote it:
$(document).ready(function(){
var myQuotes = new Array();
myQuotes[0] = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec in tortor mauris. Peter Jones, Dragons Den";
myQuotes[1] = "Curabitur interdum, nibh et fringilla facilisis, lacus ipsum pulvinar mauris, eu facilisis justo arcu eget diam. Duis id sagittis elit. Theo Pathetis, Dragons Den";
myQuotes[2] = "Vivamus purus purus, tincidunt et porttitor et, euismod sit amet urna. Etiam sollicitudin eros nec metus pretium scelerisque. James Caan, Dragons Den";
var myRandom = Math.floor(Math.random()*myQuotes.length);
$('.quote-holder blockquote span').html(myQuotes[myRandom]);
});
any help would be greatly appreciated.