JSFiddle - React, Tailwind, and code Playground

by akang2

HTML

<link rel="stylesheet" href="http://tapmodo.github.io/jsintro/css/styles.css">
<!doctype html>

  <title>Javascript Intro - Activity 4</title>

  <link href="http://fonts.googleapis.com/css?family=Open+Sans:300,800,600,600italic,300italic" rel="stylesheet" type="text/css">

<body>

  <form onsubmit="return false;" class="activity4-1">

    <h1>Greetings App</h1>

    <b>Enter your name:</b><br />
    <input type="text" id="my-name" />
    
    <div class="form-group">
      <button onclick="buttonClick();">Greet</button>
    </div>

  </form>

</body>

JavaScript

//Activity 4.3 - A simple "greeting" app

//with the form, we want to do something when the button is clicked.

//then write a function

/*
function buttonClick() {
    alert("yooo");
}
*/

function buttonClick(){
    var name = document.getElementById("my-name").value;
    alert("hey there, " + name);
}