I have a js script that I am extending to meet my needs as I'm still pretty new to JavaScript and have tried a few things but cant seem to get them to work.Here is part of JavaScript script if more is needed I can put more of it up.What I would like to do is have it work exactly the same way but instead of hitting the enter key i want to have the user click submit (or a button that looks like submit would work too) with their mouse.
(function () {
'use strict';
var ENTER_KEY = 13
var auditor = document.getElementById('auditor');
var date = document.getElementById('date');
var location = document.getElementById('location');
var workers = document.getElementById('workers');
var contact = document.getElementById('contact');
Where ENTER_KEY gets used (for second time)
function newTodoKeyPressHandler( event ) {
if (event.keyCode === ENTER_KEY) {
addTodo(auditor.value,date.value,location.value,workers.value,contact.value,company.value,exposureLocation.value,workersExposed.value,exposures.value,interventions.value,interventionComments.value,additionalComments.value,programManagement.value);
auditor.value = '';
date.value= '';
location.value = '';
workers.value = '';
contact.value = '';
company.value = '';
exposureLocation.value = '';
workersExposed.value = '';
exposures.value = '';
interventions.value = '';
interventionComments.value = '';
additionalComments.value = '';
programManagement.value = '';
}
}
If anyone could help to accomplish this I would greatly appreciate it. I already know ill have to change event.keyCode to something else but the things I tried were to no avail. Thanks