-
Scratchpad is a convenient way to develop
-
and test your JavaScript. This website is
-
supposed to compare the two text areas
-
above and put the result underneath when
-
I clicked the "Diff" button. I've written
-
the HTML and CSS and included some
-
JavaScript library functions but I
-
haven't yet hooked them up so when I
-
click the button nothing happens.
-
Scratchpad is a source editor. When I click
-
display the code is evaluated in the
-
current page and the result is pasted
-
back into the pad as a comment. This is
-
telling me that I probably have a typo
-
in my selector.
-
Let's assign these two variables and
-
compare them using the library function.
-
DIsplay makes it really easy to check
-
that I'm on the right track.
-
Let's assign this to the output dev and this
-
time I'll choose run and it just runs the
-
script in the page. That looks good so
-
I'll wrap this in a function and assign
-
it the "Diff" button click event and this
-
time I'll choose reload and run.
-
It reloads the current page with the script
-
attached and "Diff" works. I can save this
-
file back to disk. Close Scratchpad.
-
Reload the page. This is just a really
-
quick introduction to Scratchpad.
-
For more information, visit developer.mozilla.org.