Example html:
<form id="app-form">
<label for="firstname" class="standard-label">
First Name
<input name="firstname" id="firstname" type="text">
</label>
<label for="lastname" class="standard-label">
Last Name
<input name="lastname" id="lastname" type="text">
</label>
<input id="submit-app" type="submit" name="submit" value="Submit" onclick="logValues()">
</form>
I want clicking the submit button to call the logValues function which is below.
JavaScript / jQuery
function logValues() {
console.log($('app-form').serializeArray());
}
I want this to log an array of the updated key:values into the console when the user has completed the form.
Currently I can call the function manually and it will log an empty array, because no input has been recorded but clicking the submit button does nothing.