There is 1 feedback form in a popup window. And a few buttons to call this pop-up (products).
How to send a form to understand which button it was called from?
At the same time, without making a separate pop-up window and form for each button.
I saw somewhere that a script is tied to buttons: onclick = " script ", but the browser swears, thinking that there is clickjacking and other malicious scripts.
Sandbox with preparation https://jsfiddle.net/Mesuti/jkjsazcq/
<!-- Вот здесь информация о товаре --> <p> Вы выбрали товар = <span id="info"></span></p> <!-- Вот здесь нужно обозначить с какой кнопки была вызвана форма --> <input id="info" type="hidden"> <input type="text" placeholder="Ваше имя?"> <br><br> <input type="text" placeholder="Ваш телефон?"> <br><br><br><br> <!-- Товары --> <button id="item" value="Товар 1">Товар 1</button> <button id="item" value="Товар 2">Товар 2</button> <button id="item" value="Товар 3">Товар 3</button> <button id="item" value="Товар 4">Товар 4</button> <button id="item" value="Товар 5">Товар 5</button> <script> var y = document.getElementById("item").value; document.querySelector('#info').innerHTML = y; </script>
id="info",id="item"-idmust be unique on the page. - Igor