Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
    <div id="js_example">
      <p id=js_intro_text>Introduce yourself!</p>
      <form id="js_form">
        <label for="name_form">Please enter your name:</label>
        <input id="name_form" type="text" name="full_name">
        <br>
        <input type="submit" value="submit">
      </form>
      <p id="js_intro_answer"></p>
    </div>
  <!-- language: lang-js -->
<script>
    document.querySelector("#js_example").addEventListener("submit", myFunction);
    function myFunction (event) {
        event.preventDefault();
        alert("Submit event fired on form with id " + this.id);
    }
</script>
<!-- end snippet -->
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
dorwardpro
0viewers