Jquery Typeerror variable is undefined
<p>I am tryign to dynamically create rows when entry is made.i am getting TypeError: arrDetail[tempcount] is undefined.I am using firefox latest version.I want to know whether it is a browser problem or coding problem.Help is appreciated. Thanks in advance.
My code is given below</p>

<pre><code>function makeDivTag(St)
{
    //alert("makediv");
     alert("tempcount");
        var i ;
        //var num = Number(document.getElementById("divLst_count").value) + 1;

    //var divIdName = "my"+(num-1)+"Div";
    var divName=0;
    strHTML = '';
    alert("selitem makediv" + selItem);
    if (selItem == -1)
    {
        alert("in for");
      for(i=0;i&lt;=arrCount;i++)
      {
        divName= "my" + tempcount +"Div";
        strHTML = strHTML +"&lt;TR id="+divName+"&gt;";
        strHTML = strHTML +"&lt;TD&gt;&lt;INPUT type=\"text\" class=\"divtext\" style=\"width:100;text-align:left;\" name=\"lstacode[]\"  id=\"lstacode[]\" value='"+ arrDetail[tempcount][1] +"'&gt;&lt;/TD&gt;";

        strHTML = strHTML +"&lt;TD&gt;&lt;INPUT type=\"text\" class=\"divtext\" style=\"width:300;text-align:left;\" name=\"lstaccountname[]\" value='"+ arrDetail[tempcount][2] +"'&gt;&lt;/TD&gt;";

        strHTML = strHTML +"&lt;TD&gt;&lt;INPUT type=\"text\" class=\"divtext\" style=\"width:90;text-align:left;\" name=\"lstamount[]\" value='"+ arrDetail[tempcount][5] +"'&gt;&lt;/TD&gt;";
        strHTML = strHTML +"&lt;INPUT type=\"hidden\" name=\"lstremarks[]\" value='"+ arrDetail[tempcount][7] +"'&gt;";

        strHTML = strHTML +"&lt;INPUT type=\"hidden\" name=\"lstprev_acode[]\" value='"+ arrDetail[tempcount][8] +"'&gt;";


        if (St=='0')
        {

            strHTML = strHTML +"&lt;TD&gt;&lt;INPUT type=\"button\" name=\"V\" class=\"lstButton\" value=\"View\" onClick=\"displayDivRow(document.frmcashpayment,'"+ tempcount +"');\" &gt;&lt;/TD&gt;";
        }
        else
        {

            strHTML = strHTML +"&lt;TD&gt;&lt;INPUT type=\"button\" name=\"E\" style=\"width:20;\" class=\"lstButton\" value=\"M\" onClick=\"displayDivRow(document.frmcashpayment,'"+ tempcount +"');\"&gt;";


            strHTML = strHTML +"&lt;INPUT type=\"button\" name=\"D\" style=\"width:20;\" class=\"lstButton\" value=\"D\" onClick=\"removeDivRow(document.frmcashpayment,'"+ tempcount +"');\"&gt;&lt;/TD&gt;";
        }
        strHTML = strHTML +"&lt;/TR&gt;";
    }

    $("#divList &gt; tbody").append(strHTML);
    }
    else
    {
         alert("selitem in makediv else" + selItem);
         alert(document.getElementById('hidacode').value);
        document.getElementsByName("lstacode[]")[selItem].value = document.getElementById('hidacode').value;
        document.getElementsByName("lstaccountname[]")[selItem].value = document.getElementById('txtaccountname').value;
        document.getElementsByName("lstamount[]")[selItem].value = document.getElementById('txtamount').value;
        document.getElementsByName("lstremarks[]")[selItem].value = document.getElementById('txtremarks').value;

    }
    //$("#divList &gt; tbody").append(strHTML);
}
</code></pre>

<p>I am dynamically trying to create a rows when entry is made.Help is appreciated. Thanks in advance.</p>
