There is a modal window. The logic of the work, when you click on the button, two inputs are added. Is done through js? Is there an example?
2 answers
$("button").click(function() { $("div").append("<input type='text' placeholder='first'>"); $("div").append("<input type='text' placeholder='second'>"); }) <div> <button>Click!!</button> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> - And how to set the id, how do I know which one it will be, do I need to get rid of the data? - Anton Prokhorov
- Aidi is defined as id = "id_name" - Tigran Vardanyan
|
function addTwoInputs() { var inp = document.createElement("input"); inp.setAttribute("placeholder", "first"); document.getElementById("container").appendChild(inp); inp = document.createElement("input"); inp.setAttribute("placeholder", "second"); document.getElementById("container").appendChild(inp); } <button onclick="addTwoInputs()">Click</button> <div id="container"></div> |