Here’s a simple Javascript program triggered by an HTML form. Enter some text, then click Count this.  Javascript executes when the Count this button submits the form, then writes the result of the word count to a label. It shows:

  • Minimal Javascript program
  • How to write to a label using Javascript
  • how to use getElementByID

Run this program