Displaying text in Javascript


  • Create a basic html
  • Set the page title
  • Display static header text
  • Include a Javascript file in our html
  • Get a reference to an html element and change its text content.

The html page for the application. We will use a div to display text to the user. We set an id for the div so we can grab it from Javascript. And we also include our Javascript file.



That’s it. We can open our index.html file in chrome, just double click it, and we will see our hello world! message displayed on the webpage.

Sample Page:
http://javascript.kennyming.com/code/1-displaying-text/

Sample Code:
https://github.com/kennymingt/javascript/tree/master/code/1-displaying-text

Comments

Popular posts from this blog

Installing wxMaxima on macOS and Fixing the crash with plotdf() Function when calling wish tcl-tk

How to Set Up LaTeX (BasicTex) with Visual Studio Code on macOS