Browse Source

Initial commit

master
Peter J. Jones 7 years ago
commit
f46e5673aa
4 changed files with 72 additions and 0 deletions
  1. 19
    0
      README.md
  2. 16
    0
      behavior.js
  3. 30
    0
      playground.html
  4. 7
    0
      style.css

+ 19
- 0
README.md View File

@@ -0,0 +1,19 @@
# jQuery Playground

Using the `playground.html` file and a web console such as Firebug,
the jQuery Playground is a great place to experiment with jQuery
features.

# What to Play With

Here is what I suggest:

1. Write some JavaScript in `behavior.js` so that when one of the
`<li>` elements is clicked, it is removed from the DOM.

2. Add more code to `behavior.js` so that when someone writes text
into the form and presses the "Add" button a new `<li>` element
is created with the text from the form.

3. Make new `<li>` elements yellow for 2 seconds, then return them
to normal.

+ 16
- 0
behavior.js View File

@@ -0,0 +1,16 @@
function ExampleBehavior () {
this.initialize();
}

ExampleBehavior.prototype = {
initialize: function () {
this.sayHello();
},
sayHello: function () {
console.log("Here I am, come find me.");
}
};

$(document).ready(function () {
new ExampleBehavior();
});

+ 30
- 0
playground.html View File

@@ -0,0 +1,30 @@
<html>
<head>
<title>jQuery Playground</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="behavior.js" type="text/javascript"></script>
</head>

<body>
<h1>Welcome to the jQuery Playground</h1>

<ul id="bands">
<li>Death Cab for Cutie</li>
<li>Depeche Mode</li>
<li>Peter Bjorn and John</li>
<li>The Knife</li>
<li>The Presets</li>
<li>Vampire Weekend</li>
<li>Zero 7</li>
</ul>

<form id="add-band">
<p>
<label>Enter a Band Name:</label>
<input name="band" type="text"/>
<input name="submit" value="Add" type="submit"/>
</p>
</form>
</body>
</html>

+ 7
- 0
style.css View File

@@ -0,0 +1,7 @@
.new {
background-color: yellow;
}

.deleted {
background-color: red;
}

Loading…
Cancel
Save