I am newly learning code and have encountered some issues with javascript/jquery and how it is running/being displayed on my HTML page.
At this point in time I am running drills in CodePen and have run into an issue where my HTML heading is not being displayed on my page load but my javascript is running as expected. My goal is to have my displayed and the javascript running below it and I suspect it has something to do with my usage of the $(document).ready
method.
Is there something I am missing or misunderstanding in my code that when my page loads the h2 is not showing up?
$(document).ready(function() {
for (x = 1; x < 100; x++) {
if (x % 3 === 0 && x % 5 === 0) {
document.write("FizzBang" + '<br/>')
} else if (x % 3 === 0) {
document.write("Fizz" + '<br/>')
} else if (x % 5 === 0) {
document.write("Bang" + '<br/>')
} else {
document.write(x + '<br/>')
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<h2>Challenge 2</h2>