I've been trying to get the value from a text input, but for some reason, it's not working.
Essentially, I have a text input. The user types inside of the input, and I'd expect the .value
property to change (which chrome says it does), but when I click to save it, and read my JSON output, it returns as a blank string.
Here's the HTML for this bit:
<input id="eventName" name="efrm" type="text" value="" />
<button type="button" id="okEvent">Save Event</button>
Here's the JS that you'll need to see:
document.querySelector("#okEvent").addEventListener("mousedown", applyEvent(event), false);
function applyEvent(event) {
var eventName = document.querySelector("#eventName").value;
event.data = {
name: eventName,
img: null,
type: 1,
fov: 0,
orientation: 1,
trigger: 1
};
}
The JSON output says that the name property of the event.data object is an empty string, though. I'm really not understanding what's going on here.