O'Reilly logo

Elm Web Development by Ajdin Imsirovic

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Getting started with writing Elm code

Navigate to the hello world example on the official online editor: http://elm-lang.org/examples/hello-HTML.

The code is as follows:

import HTML exposing (text)main = text "Hello, World!"

The preceding code compiles to a simple Hello, World! output. But what is this output? Is it an HTML element? No. It is actually just a DOM text node. And since text nodes need to have an element attached to them, this text node gets attached to the topmost element that actually gets rendered, which is the <body> element. You can verify this by inspecting the rendered text in your browser's Developer Tools.

Let's do something else here. Let's render an actual HTML element on the page. To do this, we need to pass in a ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required