<form id="form"> <input type="text" class="form-control" name="number /> <button class="btn" type="button" onclick="fun();>Принять</button> </form> function fun() { var str = document.getElementById("form").value; alert(str); } There are several forms of this type, their code is absolutely the same. How to make it so that the data that I enter in the <input> field, when you press the <button> transferred to one function, and for example, alert(); while displaying different content. That is, I entered into the fourth field 2 - a window with the number two appeared.
alertbe displayed? If there are several identical forms, then why forms haveid? - user207618 pmidis an attribute of the page theme. - Straight Edge