These are chat archives for codefellows/sea-f1-TAs/Zach

22nd
Sep 2014
Ryan
@rraeburn
Sep 22 2014 04:49
anyone know how I could grab user input from a html form to fill in object properties?
I've got the form and I think the correct jQuery setup, but I can't quite figure out how to do all this before the javascript runs the race and also input the user racer
muhammed safa yaşar
@msafayasar
Sep 22 2014 07:11
This message was deleted
this is the way I did
var rabbitName = document.getElementById("rabbitName").value;
var rabbitSpeed = document.getElementById("rabbitSpeed").value;
var rabbitAge = document.getElementById("rabbitAge").value;
var rabbitFocus = document.getElementById("rabbitFocus").value;

var turtleName = document.getElementById("turtleName").value;
var turtleSpeed = document.getElementById("turtleSpeed").value;
var turtleAge = document.getElementById("turtleAge").value;
var turtleFocus = document.getElementById("turtleFocus").value;

var meters = document.getElementById("raceMeterInput").value;

var rabbit = new Animal(rabbitName, rabbitSpeed, rabbitFocus, rabbitAge);
var turtle = new Animal(turtleName, turtleSpeed, turtleFocus, turtleAge);
muhammed safa yaşar
@msafayasar
Sep 22 2014 07:17
Just get the element from the form and put it in a variable. Then you can use the variable in the object