I know there is a a lot of confusion in my question, and I am a beginner in javascript, so please bear with me. I am looping through an array of 120 numbers using java script and I am trying to print out certain words under certain conditions. When a number in the array is divisible by 3 I want to print Go, when its divisible by 5, I want to print GoGo and when its divisible by both 3 and 5 and I to print out GOGOGadget.
I am nested an if statement inside my for loop and I also want to append the printout to the DOM.
html:
<html>
</head>
<body>
<h1>Javascript printout</h1>
<button>
Click Me
</button>
<p class="printout">0</p>
</body>
</html>
JavaScript :
( document ).ready(function() {
$("button").click(function(){
var Count = ["1", "2", "3","4"];
for (var i = 0; i > 4; i++) {
if (Count%1) {
$("printout").text("Go");
$("printout").append(Go);
}
}
});
});
$("printout")
is looking for a DOM tag named "printout" -- like "div" or "a". What is the HTML you are using? – Casey Falk Aug 13 '14 at 20:19