I think I've got most of this done, in the best way I know how to anyway. I'm just struggling with the final bit.
I'm trying to generate several quotes at a time, split out by a <br /> tag, depending on what option has been chosen from a dropdown list.
(function ($) {
var quotes = ["Quote 1", "Quote 2", "Quote 3", "Quote 4", "Quote 5", "Quote 6", "Quote 7", "Quote 8", "Quote 9", "Quote 10", "Quote 11", "Quote 12", "Quote 13", "Quote 14", "Quote 15"];
$('.generate').click(function(){
var randomQuote = quotes[Math.floor(Math.random()*quotes.length)],
quotesSelected = $( "select option:selected" ).html();
if (quotesSelected > 1) {
$('.quote').html(randomQuote + ' -- ' + quotesSelected + ' selected ');
} else {
$('.quote').html(randomQuote);
}
});
}(jQuery));
Fiddle: http://jsfiddle.net/mwbhydbu/
So for example -
If 3 is selected, you would be returned with something like Quote 3 <br /> Quote 8 <br /> Quote 1
I hope that makes sense.
This is the particular line I'm struggling with:
$('.quote').html(randomQuote + ' -- ' + quotesSelected + ' selected ');
Any help would be very much appreciated!
.quotelist?