fle*_*ale 1 javascript jquery image google-chrome-extension
我正在制作Chrome扩展程序并且想知道,使用JS/jQuery循环遍历当前文档中的每个IMG对象的最佳方法是什么?
jAn*_*ndy 10
Array.prototype.forEach.call( document.images, function( img ) {
// ecmascript5 plz (but we accept a shim also)
});
Run Code Online (Sandbox Code Playgroud)
jQuery的:
$("img").each(function() {
console.log($(this).prop("src"));
});
Run Code Online (Sandbox Code Playgroud)
记录src控制台中的每个图像.