How to open same window, but to handle different values?

Next task:
There are two buttons and two headers. When you press any of the buttons opens the same window. There are input, into which you can enter a value (text). But the input values must not overlap.
That is, if I clicked on the first button, the window opened, I put the values in the first title fit the text that I specified in the input.
Clicking the second button the button again the window opened, and when writing a text, it fits in the second header.

Need to automate the process. Let these buttons STO. Of course, I don't want to register the function for each button to open a new window with the new input.

Hope the challenge is clear. Tell me how it can be implemented. Thank you in advance for your help.
April 3rd 20 at 18:33
3 answers
April 3rd 20 at 18:35
Solution
Tried to write not optimal, but simpler
Any strange place Google or ask in the comments

Yes, I have nothing to do
Super, you do what you need. I will understand, thanks) - Tina commented on April 3rd 20 at 18:38
April 3rd 20 at 18:37
Solution
Naves buttons date attributes, when the click event cityway them, say to the function to open forms, perezapisi values of the parameters to this function. Approximately
April 3rd 20 at 18:39
Well, if the task is clear then look for a freelancer. For the specific question I do not see. And if you think this task as the question is not feasible for you, then divide it into subtasks, and therefore ask questions. And even better still attach your attempted implementation.
The question "how to implement it"? At this point I was prescribed functions for each button, because there are not many. Respectively open different Windows with different inpute.

If anything, I don't have a direct solution. At least thoughts on how to do it. Ideas etc - Tina commented on April 3rd 20 at 18:42
@Tina, what is "function for each button?" - Rolando65 commented on April 3rd 20 at 18:45
@Rolando65, I understand that the event handler) - leonard_Runolfsson7 commented on April 3rd 20 at 18:48
@Tina, well, then the logic I guess would be: you are the most functions are rewritten as the event handler and the cycle progoneate all inputs, assign a handler to the event for each field.
UPD: @leonard_Runolfsson7 gave an example of how you can walk through the loop and tie to each element(event) handler - Terry60 commented on April 3rd 20 at 18:51
@Terry60, the solution above is, apparently, suitable. I will figure this out - Tina commented on April 3rd 20 at 18:54
@Tina, @Tina, good luck - Terry60 commented on April 3rd 20 at 18:57

Find more questions by tags JavaScriptjQuery