次のコードのように、jQuery $('body')
に相当するjavascriptはありますか?私はjQueryを必要とせずに実行したいです。
var content = $('body').html();
var comments = content.match(/<!--.*?-->/g);
if(comments!=null|comments!=undefined){
for (var x = 0; x < comments.length;x++){
console.log(comments[x]);
}
}
else{
console.log('No Comments');
}
おかげ
https://gist.github.com/hughrawlinson/6078055
私はdocument.body' 'と思いますか? – Praveen