I have a global variable:
var x = document.getElementById("Node").value;
Where the value is determined by a text box with the ID of "Node".
I have two functions that don't same thing if creating preset notes based on values entered into text and drop downs. How do I call the above global variable into those functions and have it added to the created statement. Both functions look the same:
This works for one function but not when there is two. What I have is several text boxes and drop downs. One of those text boxes is a global value called Node. When node is filled out, I want to be able to pull that value into both functions. Here is what I have for both.
//Declare Node as a Global Variable
var x = document.getElementById("Node").value;
//Populates the Summary box
function mySummary() {
var a = document.getElementById("Field1").value;
var b = document.getElementById("Field2").value;
var c = document.getElementById("Field3").value;
var d = document.getElementById("Field4").value;
document.getElementById("Summary").innerHTML = a + " - " + b + " - " + c + " - " + x + " -" + d;
}
//Populates the Notes box
function myNotes() {
var a = document.getElementById("Field5").value;
var b = document.getElementById("Field6").value;
var c = document.getElementById("Field7").value;
var d = document.getElementById("Field8").value;
var e = document.getElementById("Field9").value;
document.getElementById("Notes").innerHTML = x + " - " + a + " / " + b + " - " + c + "% Offline - " + d + " - " + e + " - " + f;
}
The issue is that the value of X is not being pulled into both functions at the same time for the output. The output goes into a text area
If I create a local variable in each function and make the user enter the same information twice per text box it works fine, but I want them to only enter the information once and have it pulled into each text area