Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
  <script type="text/javascript">
    function addEventsToHTML(){
    var form = document.getElementById('foobar');
    form.onsubmit = submitHandler;
    function submitHandler(){
      // validate();
      alert('foo');
    }
}
window.onload = addEventsToHTML;
</script>
</head>
<body>
    <form method="POST" action="page.html" onsubmit="alert('foo'); // validate();" name="foobar">
      <input type="text" />
    </form>
  
    <div onclick="document.foobar.submit();">click me</div>
</body>
</html>
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers