summaryrefslogtreecommitdiffstats
path: root/example/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'example/index.html')
-rw-r--r--example/index.html34
1 files changed, 20 insertions, 14 deletions
diff --git a/example/index.html b/example/index.html
index 6f9cfe9..7a2c13b 100644
--- a/example/index.html
+++ b/example/index.html
@@ -1,18 +1,24 @@
<!DOCTYPE html>
<html>
- <head>
- <script src="../node_modules/jquery/dist/jquery.js"></script>
- <script src="../jquery.once.js"></script>
- </head>
- <body>
- <h1>jQuery Once</h1>
- <p>This is some text, which should stay green.</p>
- <script>
- // Change the color of the text to green.
- $('p').once('changecolor').css('color', 'green');
+ <head>
+ <script src="../node_modules/jquery/dist/jquery.js"></script>
+ <script src="../jquery.once.js"></script>
+ </head>
+ <body>
+ <h1>jQuery Once</h1>
+ <p>This is some text, which should stay green.</p>
+ <script>
+ // Change the color of the text to green.
+ $('p').once('changecolor').css('color', 'green');
- // Attempt to change the color again.
- $('p').once('changecolor').css('color', 'red');
- </script>
- </body>
+ // Attempt to change the color again.
+ $('p').once('changecolor').css('color', 'red');
+
+ // Now change the background color.
+ $('p').once('changebackground').css('background-color', 'black');
+
+ // Change it again.
+ $('p').once('changebackground').css('background-color', 'yellow');
+ </script>
+ </body>
</html>