This is your PHP-loop in javascript. Pretty much the same… Just remember to use the <script> javascript code here </script>
tag to tell the browser that this is javascript
for (a = 1; a < 2; a++) {
//Your stuff inside here
}
To append HTML to a div you can use the following code:
document.getElementById('divID').innerHTML = '<p>your data here</p>';
Or if you include Jquery as well it can be done even simpler:
$('#divID').append('<p> your data here </p>');
7
solved How do I make this javascript in loop?