I am building a User login system. New users are provided a blank account. This system uses Bootstrap Modals to allow users to submit Name, Username etc. to their newly provided account. I have code running to build the forms and everything works great, until the user goes to submit the data.
jav.js
$("#BodyContainer").append('<p id="btn2"><button type="submit" class="btn-lg btn-dark " id="btnLogin" name="btnLogin">Login</button></p>');
document.getElementById('btnLogin').addEventListener('click', loginProcedure);
$('#verifyForm').append('<button type="submit" class="btn btn-success btn-block" id="btnSubmitUserDetails" name="btnSubmitUserDetails"><span class="glyphicon glyphicon-upload"></span> Submit</button>');
document.getElementById('btnSubmitUserDetails').addEventListener('click', function(){ submitUserData() });
The Login option works fine as seen here in the inspector. The function is running on the click event and is named properly.
However the portion to allow the user to Submit their data is completely broken? The NAME of the method ended up INSIDE of the method I hoped to create?
I obtained this code from another website I had written about a year or so back. And it seemed to function fine then? I just cannot figure out what has changed syntactically since I last used it?
I have also tried:
document.getElementById('btnSubmitUserDetails').addEventListener('click', function(){ submitUserData(); });
document.getElementById('btnSubmitUserDetails').addEventListener('click', function()submitUserData(){ });
document.getElementById('btnSubmitUserDetails').addEventListener('click', function(), submitUserData);
document.getElementById('btnSubmitUserDetails').addEventListener('click', function, submitUserData());
document.getElementById('btnSubmitUserDetails').addEventListener('click', function, submitUserData(););
Just to see if maybe I had fudged the syntax somewhere? However everything except my posted faulty code sample simply crashes the js all together?
I just really want to run the submitUserData() on button click. But I am filling my function with the name instead of naming the function?