Skip to content

Instantly share code, notes, and snippets.

@cdaringe
Forked from anonymous/index.html
Created November 20, 2017 16:36
Show Gist options
  • Save cdaringe/de95112042b26fae80d761dc19ab38c5 to your computer and use it in GitHub Desktop.
Save cdaringe/de95112042b26fae80d761dc19ab38c5 to your computer and use it in GitHub Desktop.
Form Bugs // source http://jsbin.com/tebeqalaju
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="https://code.jquery.com/jquery-2.2.4.js"></script>
<title>Form Bugs</title>
</head>
<body>
<form id='wacky-form'>
<input type='text' />
<button type='submit'>Submit</button>
<p id='message'><p>
</form>
<script id="jsbin-javascript">
// Click "Run with JS"
// Observe the form load and disappear.
// - Add a comment explaining why this is happening
// - Add a fix in the handleSubmit function to
// keep the form on screen
$('#wacky-form').on('submit', function handleSubmit (evt) {
console.log('handling submit')
$('#message').text('SUCCESS')
})
$('button').click()
</script>
<script id="jsbin-source-javascript" type="text/javascript">// Click "Run with JS"
// Observe the form load and disappear.
// - Add a comment explaining why this is happening
// - Add a fix in the handleSubmit function to
// keep the form on screen
$('#wacky-form').on('submit', function handleSubmit (evt) {
console.log('handling submit')
$('#message').text('SUCCESS')
})
$('button').click()</script></body>
</html>
// Click "Run with JS"
// Observe the form load and disappear.
// - Add a comment explaining why this is happening
// - Add a fix in the handleSubmit function to
// keep the form on screen
$('#wacky-form').on('submit', function handleSubmit (evt) {
console.log('handling submit')
$('#message').text('SUCCESS')
})
$('button').click()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment