Please tell me how when you click on the button assign a unique id in the html tag
<p id="">Текст</p> Source
<textarea readonly id="txt" type="text" name="area" style="width:100%; height:300px; "> <?php echo file_get_contents('textfile.txt') ?> </textarea> <br> <input class="btn btn-success mr-2" id="tx2" type="button" onclick='document.querySelector("textarea[name=area]").value+="<p class=\"dragElement txt\">" + document.getElementById("tx").value + "</p>"' value="Вставить текст"> <input id="tx" type="text" placeholder="Введите ваш текст">