I am trying to make a script that counts how many external scripts I have on my site.
$( document ).ready(function() {
$tags = $("script[src*='http']");
$.each($tags, function(index, value) { console.log("INDEX: " + index + " VALUE: " + value ); });
});
Index is working as intented, but the value that is printed to the console is [object HTMLScriptElement]. How can I modify my script to print the value for src attribute?
I already tried these two changes:
- From
$("script[src*='http']")to$("script[src*='http']").attr('src') - From
valuetovalue.toString()