1

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?

3
  • 2
    And what exactly is your question? Commented Nov 28, 2010 at 4:48
  • 1
    It works for me. Can you provide a more complete example. Maybe create a jsFiddle page, and post the link here. Commented Nov 28, 2010 at 4:50
  • no problem with script, what you trying to do or have any issue? Commented Nov 28, 2010 at 4:51

1 Answer 1

2

Try this:

$("script, link").each(function () {
   alert($(this).attr('type')); //:)
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.