Solved

Alert not firing

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

This article discusses how to create an extensible mechanism for linked drop downs.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

830 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