var ht={}; ht["title"] = $("title").text().trim(); ht["description"] = $("meta[name=description]").attr("content").trim(); ht["keywords"] = $("meta[name=keywords]").attr("content").trim(); var hs=[]; for (var i=0;i<6;i++) { hs[i]="h"+(i+1); ta=[]; $(hs[i]).each(function() { var t = $(this).text().trim(); ta.push(t); }); ht[hs[i]] = ta.join(","); } console.log(ht);
No comments:
Post a Comment