So im experimenting with a simple form submission and I'm using node js to write the form information to a text file, the problem is that I cant seem to call an HTML 'id' in node js.
const fsLibrary = require('fs')
let data = frm1
fsLibrary.writeFile('data.txt', data, (error) => {
if (error) throw err;
})
<!DOCTYPE html>
<html>
<head>
<script src="main.js"></script>
</head>
<body>
<p>Please enter the following information and submit the form</p>
<form id="frm1">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br><br>
Date Of Birth: <input type="text" name="dob"><br>
Home Address: <input type="text" name="addr"><br><br>
Country: <input type="text" name="country"><br>
Zip Code: <input type="text" name="zip"><br><br>
SSN: <input type="text" name="ssn"><br>
Primary phone number: <input type="text" name="phone"><br><br>
Primary email: <input type="text" name="email"><br>
Secondary phone number: <input type="text" name="sphone"><br><br>
Secondary email: <input type="text" name="semail"><br><br>
<input type="button" onclick="submit()" value="Submit">
</form>
<script>
function submit() {
document.getElementById("frm1").submit();
}
</script>
</body>
</html>