Skip to content

Instantly share code, notes, and snippets.

@ewalk153
Created August 28, 2024 12:45
Show Gist options
  • Save ewalk153/1a33328968b801629eb3695aac055f1c to your computer and use it in GitHub Desktop.
Save ewalk153/1a33328968b801629eb3695aac055f1c to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Home</title>
<script>
function checkStatus() {
var queryString = parseQueryString();
if (queryString['name']) {
var result = document.getElementById('result');
result.innerHTML = 'Form submitted';
}
}
function parseQueryString() {
var query = window.location.search.substring(1);
var vars = query.split("&");
var queryString = {};
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
queryString[pair[0]] = pair[1];
}
return queryString;
}
</script>
</head>
<body onload="checkStatus()">
<h1>This is an example for to show the behavior of hitting enter</h1>
<form>
<input type="text" name="name" placeholder="Name" required>
<input type="submit" value="Submit">
</form>
<div id="result"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment