info343/minilabs/5/solutions.php

<script src="<?= $BASENAME ?>/lib/global/js/prettify/lang-css.js" type="text/javascript"></script>
<script src="<?= $BASENAME ?>/lib/global/js/prettify/lang-js.js" type="text/javascript"></script>

<p>Below is one possible solution to this problem.</p>

<h3>Exercise 2: Select Elements Using jQuery</h3>

<ol>
   <li><code>$('p')</code></li>
   <li><code>$('#benefits p')</code></li>
   <li>
      <p><code>$('#benefits p.note')</code></p>
      <ul>
         <li><code>$('#benefits p.note').css('background-color', 'fuchsia')</code></li>
      </ul>
   </li>
   <li><code>$('a');</code></li>
   <li>
      <p>There are two possibilities for this:</p>
      <ul>
         <li><code>$('a:not(li.important <strong>a</strong>)')</code></li>
         <li><code>$('a').not('li.important <strong>a</strong>')</code></li>
      </ul>
      <p>In either case, the <code>a</code> at the end of the <code>not</code> is crucial since we’re excluding a particular link.</p>
   </li>
   <li>
      <p><code>$('abbr')</code></p>
      <ul>
         <li><code>$('abbr').attr('title', 'Application Programming Interface')</code></li>
      </ul>
   </li>
</ol>


<header>
   <h3>Exercise 3: Modify the Page Using jQuery</h3>
   <div class="workinglink"><a href="solution/minilab5.html">working example</a></div>
</header>

<h4>minilab5.html:</h4>
<pre class="prettyprint lang-html linenums"><?= escape(load(dirname(__FILE__) . "/solution/minilab5.html")) ?></pre>

<h4>minilab5.js:</h4>
<pre class="prettyprint lang-js linenums"><?= escape(load(dirname(__FILE__) . "/solution/minilab5.js")) ?></pre>