Skip to main content

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

In this blog post, I'll guide you through the process of installing wxMaxima on your macOS machine and resolve a common issue related to the plotdf() function in macos Sonoma wiht maxima 5.47, and all other functions that call the tcl-tk interpreter wish . The plotdf() Function Issue MacOS Sonoma comes with a preinstalled Tcl-TK package. One problem you might encounter when using Maxima is that the plotdf() function or ploteq() , which is used for plotting differential equations, crashes. This issue arises because Maxima calls the wish script from the tcl-tk package, but the version of tcl-tk that comes pre-installed with macOS can be problematic. There's an easy fix for this problem: installing tcl-tk and Maxima using Homebrew. Step-by-Step Installation with Homebrew Homebrew is a popular package manager for macOS that makes installing software a breeze. Follow these simple steps to install wxMaxima and resolve the plotdf() issue:...

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

LaTeX is a powerful typesetting system that can help you achieve that. In this post, I'll guide you through the process of installing a minimal LaTeX distribution called BasicTex on your macOS machine and setting it up with the popular Visual Studio Code (VSCode) editor. Step 1: Install BasicTex While the full MacTeX distribution provides a comprehensive LaTeX installation, it can be quite large (over 5GB). If you're just starting with LaTeX or have limited storage space, you might want to consider installing BasicTex instead. BasicTex is a smaller alternative that contains all the essential tools you need to create and compile LaTeX documents. Here's how to install BasicTex: Visit the MacTeX website and navigate to the More Packages section . Scroll down to the "A Smaller Distribution, Basic TeX" section and click on the "BasicTeX.pkg" link to download the installer. Once the download is ...