I'm currently working on building a simplified version of an online citation generator. This project involves creating over 20 input boxes, each requiring the user to enter an author's name. To streamline this process, I've divided the author’s name into two variables - lname and fname. My getElementById function will consist of these variables along with additional factors based on the specific requirements.
Within the JavaScript code, I have defined the variable 'lname' which corresponds to the first input box. However, when attempting to use the same variable for the second input box, it outputs the data from the initial box. While I could create a separate function for each input box, I believe there should be a way to reuse a variable from one function in another. Is this possible?