开发者

jQuery each function html list, just return object

I have a bit of problem with my function who just should return html code

function contentStringHtml(data, name) {
    return '<div id="gm-event-title">' +
            '<h2>' + name + '</h2>' +
            '</div>' +
            '<div class=\"gm-trafic-index\"&开发者_如何学Pythongt;<ul>' +
            $.each(data.DataTime, function(i, item) {
                return '<li class=\"gm-trafic-li"\>' + item.TimeAndTo + '</li>';
            });
            + '</ul></div>';
}

the don't return the {0} in the each loop.


function contentStringHtml(data, name) {
    var list;
    $.each(data.DataTime, function(i, item) {
        list += '<li class="gm-trafic-li">' + item.TimeAndTo + '</li>';
    });
    return '<div id="gm-event-title"><h2>'+name+'</h2></div>' +
            '<div class="gm-trafic-index">' +
            '<ul>'+list+'</ul></div>';
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜