开发者

jQuery.append function gives me NaN at the end

开发者 https://www.devze.com 2023-02-11 08:08 出处:网络
I have written some simple jquery code : function Generate(result, counter) { $(\"#ArchivesContent\").append(

I have written some simple jquery code :

function Generate(result, counter) {
            $("#ArchivesContent").append(
                "<table width='100%'>" +
                "<tr>" +
                    "<td width='20%'>" +
                     "<a class='A_archClass' href='detailsDocument.aspx?id=" + result.d[counter].ID + "'>"
                          + result.d[counter].Date +
                     "</a>" +
                    "</td>" +
                    "<td width='20%'>" +
                       "<a href='detailsDocument.aspx?id=" + result.d[counter].ID + "'>" + result.d[counter].Title + "</a>" +
                    "</td>" +
                     "<td width='60%'>" +
                           "<img style='width:100px;height:136px;' alt='' src='" + result.d[counter].Image.replace("~/", "") + "' />" +
                    "</td>" +
                "</tr>" +
                "</table>" +
                +"<开发者_C百科hr />"
             );
        }

I use visual studio to debug my jquery code it works every thing is fine but at the end of the "< / table>" tag insert and show "NaN" value this function is repeat once.


Maybe this part has something to do with it:

"</table>" +
+"<hr />"


Yes, you typed additional plus (the second plus is considered as a positive sign that expects a number). You shall replace with "" + "


".

0

精彩评论

暂无评论...
验证码 换一张
取 消