I have the following code:
html = []; function addTagInfo() { html.push("<div class='row'> \ <div class='col-md-4'> \ <div class='form-group'> \ <label for='usr'>Тег на странице:</label> \ <input type='text' class='form-control' id='url'> \ </div> \ </div> \ <div class='col-md-4'> \ <div class='form-group'> \ <label for='usr'>Название переменной:</label> \ <input type='text' class='form-control' id='url'> \ </div> \ </div> \ <div class='col-md-4'> \ <div class='form-group'> \ <label for='usr'>Название для CSV:</label> \ <input type='text' class='form-control' id='url'> \ </div> \ </div> \ </div>"); html.push("<button type='button' class='btn btn-success' onclick='addTagInfo()'>Еще тег</button>"); } url.onblur = function() { function isURL(str) { var urlPattern = new RegExp("(http|ftp|https)://[\w-]+(\.[\w-]+)+([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?"); // fragment locator if(!urlPattern .test(str)) { return false; } else { return true; } } if (!isURL(this.value)) { // введено не число // показать ошибку this.className = "error"; error.innerHTML = 'Вы ввели не url. Исправьте, пожалуйста.' } else { addTagInfo(); html.push("<div class='form-group'> \ <label for='isSCV'>Создать ли CSV:</label> \ <input type='checkbox' class='form-control' id='isSCV'> \ </div>"); html.push("<button type='button' class='btn btn-success'>Парсить</button>"); $('#parser').append(html.join('')); } }; </script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="container"> <p>Заполните нижеследующие поля:</p> <form id="parser"> <div class="form-group"> <label for="usr">Url:</label> <input type="text" class="form-control" id="url"> </div> <div id="error"></div> </form> </div> And for some reason, the function that should launch when you click on the "Another tag" button does not work. For the fields to appear when executing the code, it is enough to insert any valid link.