why onclick works once) in the form if textarea is added then how the cross is pressed to close the form. and textarea) I no longer know what to do, how to get there again when clicked
function postqueshion(e) { e.preventDefault(); $('.btn-ask').on("click", function() { $('#modalq').css({ 'margin-top': '-100%' }); $('#mh').append("<textarea class=" + 'not-validate' + " rows=" + 1 + " cols=" + 50 + " maxlength=" + 500 + " placeholder=" + ' Что' + ' ' + 'хотел' + ' ' + 'бы' + ' ' + 'узнать?Например:' + ' ' + '' + '«Хочу' + ' ' + 'ходить' + ' ' + 'с' + ' ' + 'вами' + ' ' + 'на' + ' ' + 'пробежки' + ' ' + 'в' + ' ' + 'Москве,' + ' ' + 'как' + ' ' + 'это' + ' ' + 'можно' + ' ' + 'сделать?» ' + ' ></textarea> '); }); $('#closes').on("click", function() { $('#modalq').css({ 'margin-top': '' }); $('#mh').remove(); }); } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <a href="#" data-main-title="Задай свой вопрос кураторам Спарты, <br>которые уже прошли этот путь <br>Напиши свой вопрос в форме ниже" data-btn="Задать вопрос" data-goal="form08" data-additional="Вопрос кураторам Спарты" data-lp-form-id="8" class="btn-ask open-callback" onclick="postqueshion(event);">Задай свой вопрос</a> when I press the button a second time to ask my question - textarea is missing) to the nbsp account, don’t say anything; D unless it is the reason
clickhandler inside a function that is called by a click? remove the function from the link, and remove from the linkonclick="postqueshion(event);this is so, for a start - Alexey Shimansky