<!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=windows-1251"> <meta name="Description" content=""> <meta name="Keywords" content=""> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous"> <title>Test</title> </head><body> <div class="justify-content-center wrap"><form name="new_record" action="test.cgi" method="get"> <h1>Test</h1><br> <div class="d-flex justify-content-center"> <script type="text/javascript"> async function paste(input) { const text = await navigator.clipboard.readText(); document.new_record.input.value = text; } </script> <input id="test_field" type="text" name="test_field" value="" placeholder="" onclick="paste(this)" required> </div> <button type="submit" class="btn btn-primary cl_btn">Отправить</button> <button type="reset" class="btn btn-primary cl_btn">Очистить</button> </div></form> </body></html>
async function paste(input) { input.value = await navigator.clipboard.readText(); }
document.new_record.test_field.value = text;