phlai
phlai

Reputation: 13

JQuery loop through <link> and <script>

I am trying to loop through the elements link and script tag

$("script").each(function () {
 alert("Test");
});

The code works for img tag but does work for the above 2?

Upvotes: 1

Views: 909

Answers (1)

Jacob Relkin
Jacob Relkin

Reputation: 163288

Try this:

$("script, link").each(function () {
   alert($(this).attr('type')); //:)
});

Upvotes: 2

Related Questions