Solved

Alert not firing

Posted on 2016-10-12
2
32 Views
Last Modified: 2016-10-13
Any idea why my alert is not firing in my jsfiddle?
https://jsfiddle.net/isogunro/btft1Lys/1/
0
Comment
Question by:Isaac
2 Comments
 
LVL 9

Accepted Solution

by:
Brian Tao earned 500 total points
ID: 41841343
Your script has 2 problems (actually 3 but 2 of them are the same).  In
for(x=0; x<=ary.length; x++){
    for (i=0; i<=ary.length; x++){
        tbl += "<tr><td>"+ary[x][i]+"</td><td>"+ary[x][1]+"</td></tr>";
        //alert(tbl);
    }
}

Open in new window

  1. You should change "<=" to "<" in both for loops, otherwise it will iterate through the non-existing ary[ary.length] which throws an exception.
  2. In the inner loop, you have a typo: it should be "i++" instead of "x++"
0
 
LVL 5

Author Closing Comment

by:Isaac
ID: 41841909
Thanks!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now