I am a complete noob when it comes to JavaScript and cannot seem to solve this problem.
I have a main.js file that was an output from Adobe animate. Within that is the following pertinent code I added:
this.button.name = "button";
this.button.on("click", function (a) {
var address = document.getElementById("addrs").value
var data ={address:address}
console.log(data)
}.bind(this));
Right now, I’m just displaying the information I typed into the TextInput('addrs')
to the console to verify everything works.
I also established a connection to a Firebase database within the index.js and there I have the following code:
push(ref(db), {
address: "1234 Maple Ln",
});
This is just a static placeholder for me to verify Firebase can receive information.
What I am trying to do is push the information that is now currently being saved to var data ={address:address}
to Firebase instead of the static address: "1234 Maple Ln"
.
All of the tutorials I’ve found online use an HTML form. How do you do this when the submit button is in a different JavaScript file than where the push()
is?