I am trying to get my fizzbuzzz solution to run on "click" and display inbetween code tags in a container but nothing is printing out when I click inside the div and I can't figure out why.
For my function I have :
function fizzbuzz(){
for (var i = 1; i < 101; i++){
if ((i % 15) === 0) {
console.log('FizzBuzz');
} else if ((i % 3) === 0){
console.log('Fizz');
} else if ((i % 5) === 0){
console.log('Buzz');
} else {
console.log(i);
}
}
}
for my index.html view I have this :
<div id="results" class="container text-center">
<p>Click to view the results of the function we just wrote: </p>
<code></code>
</div>
and for my jQuery script I have :
$("#results").click(function() {
fizzbuzz();
});
What am I doing wrong? I will greatly appreciate any feedback :)