I'm trying to get textbox inputs in my JS function on the click of a button. For some reason my console.log does not show the textbox inputs. How do I accomplish this?
Index.php:
<input placeholder="Name" type='text' name='username' id='username' maxlength="50" />
<input placeholder="Password" type='password' name='password' id='password' maxlength="50" />
<button id="testAJAX" onclick="Utilities.loadSavedGames()">Load Game</button>
js/utilties.js
var Utilities = {
loadSavedGames : function () {
var username = document.getElementById('username').value,
password = document.getElementById('password').value;
console.log(username + ", " + password); //null, blank
console.login code orlog$('[id=username]').lengthand$('[id=password]').length, and let me know