<h4>Practice Set: Basic jQuery</h4>
<p>This assignment will give you practice with some basic jQuery capabilities. There are three tasks in this practice set. Use the jQuery API documentation as needed! </p>
<p>
Your tasks are:</p>
<ol id="tasks">
<li id="firstItem">Find the items in this list and add a yellow background to them (consider using the .css() method)</li>
<li id="secondItem">Find the second item in this list (this one!), and write its HTML content to the third item (overwriting the third one's content)
</li>
<li id="thirdItem">This one gets overwritten with the content of #2 (the .html() method may be helpful here, for both reading from #2 and overwriting #3)</li>
<li id="fourthItem">Make this item disappear if you click on it! (the .click() method may be helpful)</li>
</ol>
JavaScript
$(document).ready(function(){
// code for the yellow background
$('#tasks > li').css("background-color","yellow");
//tasks = $('#tasks > li');
/* $( "p" ).click(function() {
var htmlString = $( this ).html();
$( this ).text( htmlString );
});*/
$('#thirdItem > li').html( "<li>Find the second item in this list (this one!), and write its HTML content to the third item (overwriting the third one's content)</li>" );
$("#fourthItem").click().hide.("<li>Make this item disappear if you click on it! (the .click() method may be helpful)</li> ");
/*$( "#fourthItem" ).click(function() {
$( this ).slideUp();*/
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.