PoorYorick PoorYorick - 1 year ago 93
Javascript Question

jquery does not display content

I this simple bit of test code to loop through and display content from an array. When I run it in my browser, it doesn't display or run any errors.

<title>jquery each test</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<script type="text/javascript">
var arr = ["One", "Two", "Three", "Four", "Five"];
var task = "";
$.each(arr, function(index, value) {
task += value + "<br>";
<div class="content"></div>

Answer Source

Change your ready function code with following line

          $.each(arr, function(index, value) {
            task += value + "<br>";
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download