Solved

Alert not firing

Posted on 2016-10-12
2
42 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

19 Experts available now in Live!

Get 1:1 Help Now