Interactive Lab: jQuery Selectors

Toggle Button = $('selector').addClass('highlight').animate({ marginLeft: 10}, 'fast');

Download These Files

This sentence is in <div id="myid">. It is followed by a horizontal rule.

This is a paragraph, which means it is wrapped in <p> and </p>. Those "p" tags in the previous sentence are formatted as <code>.

  • This is the first list item (<li>) in an unordered list (<ul>).
  • This is the second list item. It has a link in it.
  • This is the third list item. It has a class of "myclass otherclass"
  • This is the fourth list item. It has strong text and emphasized text.
    • second-level list item 1
    • second-level list item 2

<p class="myclass">This is another paragraph. It has class="myclass" Otherwise, nothing special about it at all.

This is a paragraph, which means it is wrapped in <p> and </p>. Those "p" tags in the previous sentence are formatted as <code>.

Instructions

    Please answer the questions below with the jQuery expression only. For example: for $('selector') just enter selector. Then press the check button to see the result. If your answer is right the text field will appear in green color.

Basics

  • Find every element (including head, body, etc) in the document
  • Find every code-element in the document (<code>)

(c) 2012 by Matthias Fischer