Skip to content

Commit

Permalink
🔧 Fix js event loop
Browse files Browse the repository at this point in the history
  • Loading branch information
worthant committed Sep 12, 2023
1 parent 66de299 commit 43a5f02
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 0 additions & 4 deletions client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,6 @@ <h1 class="info">var 1204 | Dvorkin Boris Alexandrovich | P3131</h1>
<form>
<div class="input-group">
<p>X:</p>
<form>
<p> abcd </p>
<button> submit </button>
</form>
<div id="x" class="radio-group">
<label><input type="radio" name="x" value="-3">-3</label>
<label><input type="radio" name="x" value="-2">-2</label>
Expand Down
6 changes: 3 additions & 3 deletions client/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ window.onload = function () {
document.getElementById("output").innerHTML = localStorage.getItem("session");
}

const mainForm = document.querySelector('#input-form');
mainForm.addEventListener('submit', function (e) {
const mainForm = document.querySelector('input[value="Check"]');
mainForm.addEventListener('click', function (e) {
// default action is to send the form data to the server and reload the page
// by calling .preventDefault() i am stopping the browser from doing this,
// which allows me to handle the form submission programmatically in your JavaScript code instead.
Expand All @@ -41,7 +41,7 @@ mainForm.addEventListener('submit', function (e) {
const rVal = parseFloat(rElement.value);
console.log(`X: ${xVal}, Y: ${yVal}, R: ${rVal}`);

const validator = new inputValidator();
let validator = new inputValidator();
validator.validate(xVal, yVal, rVal);

if (validator.getResponseCode() === 1) {
Expand Down

0 comments on commit 43a5f02

Please sign in to comment.