selection error in jquery with dynamic elements
<p>First of all thanks for reading. I have a problem with jQuery. I am trying to get some data with AJAX and put the result on page with dynamically created div. This works perfect. The problem occurs when I try to select the created div and do something with it </p>

<p><code>$('.myNewDiv').css('border', '2px solid #000080');</code></p>

<p>It gives me error in jQuery library</p>

<p>In Chrome debugger it is "Uncaught TypeError: Cannot read property 'slice' of undefined" on line 2234</p>

<p>And in Firebug under firefox "Array.prototype is undefined Line 3324"</p>

<p>I have no idea what is the problem so i'd be grateful for any information</p>

<p>The whole function code:</p>

<pre><code>function AddNextDiv(number) {
var url2 = '&lt;%= ResolveUrl("~/Translate/GetLineDetails") %&gt;';
        $.getJSON(url2, { textLineID: LinesIDs[number], TranslatedSubsID: '&lt;%=     Html.Encode(Model.OutputSubs.SubsID) %&gt;' }, function (result) {
            if (result == "Already in Database") return false;
            var myObject1 = JSON.parse(result);
            $("#MainField").append("&lt;div class=\"TextLineDiv\"&gt;This is line number " +  myObject1.LineNumber + " of 423&lt;br/&gt;" + myObject1.TextValue + "&lt;br/&gt;&lt;input  id=\"TranslationBox" + myObject1.LineNumber + "\" class=\"translationTextBox\"   type=\"text\" size=\"20\" /&gt;&lt;br/&gt;&lt;div id=\"CheckBoxDiv" + myObject1.LineNumber + "\"&gt;&lt;input name=\"" + myObject1.LineNumber + "\" class=\"addCheckBox\" onchange=\"HideDiv(this)\" type=\"checkbox\" /&gt;&lt;br/&gt;&lt;div class=\"NumberDiv\" title=\"" + myObject1.LineNumber + "\" onmouseover=\"CallRefresh(this)\" &gt; This line was translated &lt;div id=\"Translated" + myObject1.LineNumber + "\"&gt;" + myObject1.TimesTranslated + "&lt;/div&gt; times.&lt;/div&gt;&lt;br/&gt;&lt;br/&gt;&lt;/div&gt;&lt;/div&gt;");
            $("div#MainField div.TextLineDiv").css('border', '2px solid #000080');
            return true;
        });
    }
</code></pre>

<p>`</p>
