< Return to Video

Firefox Developer Tools - Scratchpad

  • 0:03 - 0:05
    Scratchpad is a convenient way to develop
  • 0:05 - 0:08
    and test your JavaScript. This website is
  • 0:08 - 0:10
    supposed to compare the two text areas
  • 0:10 - 0:12
    above and put the result underneath when
  • 0:12 - 0:15
    I clicked the "Diff" button. I've written
  • 0:15 - 0:17
    the HTML and CSS and included some
  • 0:17 - 0:19
    JavaScript library functions but I
  • 0:19 - 0:21
    haven't yet hooked them up so when I
  • 0:21 - 0:27
    click the button nothing happens.
  • 0:27 - 0:30
    Scratchpad is a source editor. When I click
  • 0:30 - 0:32
    display the code is evaluated in the
  • 0:32 - 0:34
    current page and the result is pasted
  • 0:34 - 0:39
    back into the pad as a comment. This is
  • 0:39 - 0:40
    telling me that I probably have a typo
  • 0:40 - 0:43
    in my selector.
  • 0:50 - 0:52
    Let's assign these two variables and
  • 0:52 - 0:56
    compare them using the library function.
  • 0:56 - 0:58
    DIsplay makes it really easy to check
  • 0:58 - 1:00
    that I'm on the right track.
  • 1:00 - 1:05
    Let's assign this to the output dev and this
  • 1:05 - 1:07
    time I'll choose run and it just runs the
  • 1:07 - 1:12
    script in the page. That looks good so
  • 1:12 - 1:14
    I'll wrap this in a function and assign
  • 1:14 - 1:19
    it the "Diff" button click event and this
  • 1:19 - 1:21
    time I'll choose reload and run.
  • 1:21 - 1:23
    It reloads the current page with the script
  • 1:23 - 1:31
    attached and "Diff" works. I can save this
  • 1:31 - 1:35
    file back to disk. Close Scratchpad.
  • 1:35 - 1:40
    Reload the page. This is just a really
  • 1:40 - 1:42
    quick introduction to Scratchpad.
  • 1:42 - 1:46
    For more information, visit developer.mozilla.org.
Title:
Firefox Developer Tools - Scratchpad
Description:

more » « less
Video Language:
English
Duration:
01:48

English subtitles

Revisions