This code will help you to get all the HTML attribute's value using HTML attribute name.
var AllElement=jQuery("Body *");
var TotalElementInBody=AllElement.length;
var TotalElementArray=[];
var TotalElementStr="";
function GetElementByAttribute(filter){
for(var i=0;i<TotalElementInBody;i++){
if(typeof (jQuery(AllElement[i]).attr(filter))!="undefined"){
if(TotalElementArray.indexOf(jQuery(AllElement[i]).attr(filter))==-1){
TotalElementStr+=jQuery(AllElement[i]).attr(filter)+", ";
TotalElementArray.push(jQuery(AllElement[i]).attr(filter));
}
}
}
console.log(TotalElementStr);
}Example 1GetElementByAttribute("class");Example 2GetElementByAttribute("id");Example 3GetElementByAttribute("src");