each循环,字符串拼接及截取

// 定义关注领域拼接id
var focusAreasIdStr = '';
$("div[name='focusArea']").each(function() {
var falg = $(this);
if ($(this).hasClass("choose-box-item-blue")) {
focusAreasIdStr += falg.attr("id") + ',';
}
});

focusAreasIdStr = focusAreasIdStr.substring(0, focusAreasIdStr.length - 1);

 

posted @ 2018-04-06 20:38  程序员小明1024  阅读(865)  评论(0编辑  收藏  举报