Skip to main content
improved formatting
Source Link

You can easily use jQuery to do this.

// takeover the #gameData form's onsubmit event
$("#gameData").submit(function(e){
     // your form processing codes here
     game['game'] = {};
     game.game['id'] = generateId(20);
     game.game['courseName'] = document.getElementById('course').value;
     game.game['gameLength'] = courseLength;
     game.game['players'] = {}; 

     var participants = document.querySelectorAll('.currentPlayers'); 

     participants.forEach(function(name){
         game.game.players[generateId(5)] = name.value;
     }

     generateCard(game.game.gameLength)

// prevent the default form submission
e.preventDefault();
});

Hope that helps!

You can easily use jQuery to do this.

$("#gameData").submit(function(e){
game['game'] = {};
game.game['id'] = generateId(20);
game.game['courseName'] = document.getElementById('course').value;
game.game['gameLength'] = courseLength;
game.game['players'] = {};
var participants = document.querySelectorAll('.currentPlayers');
participants.forEach(function(name){
    game.game.players[generateId(5)] = name.value;

generateCard(game.game.gameLength)

// prevent form submission
e.preventDefault();
});

Hope that helps!

You can easily use jQuery to do this.

// takeover the #gameData form's onsubmit event
$("#gameData").submit(function(e){
     // your form processing codes here
     game['game'] = {};
     game.game['id'] = generateId(20);
     game.game['courseName'] = document.getElementById('course').value;
     game.game['gameLength'] = courseLength;
     game.game['players'] = {}; 

     var participants = document.querySelectorAll('.currentPlayers'); 

     participants.forEach(function(name){
         game.game.players[generateId(5)] = name.value;
     }

     generateCard(game.game.gameLength)

// prevent the default form submission
e.preventDefault();
});

Hope that helps!

Source Link

You can easily use jQuery to do this.

$("#gameData").submit(function(e){
game['game'] = {};
game.game['id'] = generateId(20);
game.game['courseName'] = document.getElementById('course').value;
game.game['gameLength'] = courseLength;
game.game['players'] = {};
var participants = document.querySelectorAll('.currentPlayers');
participants.forEach(function(name){
    game.game.players[generateId(5)] = name.value;

generateCard(game.game.gameLength)

// prevent form submission
e.preventDefault();
});

Hope that helps!