Answers for "how to accept pasted image in html"

0

how to accept pasted image in html

const form = document.getElementById("new_document_attachment");
const fileInput = document.getElementById("document_attachment_doc");

fileInput.addEventListener('change', () => {
  form.submit();
});

window.addEventListener('paste', e => {
  fileInput.files = e.clipboardData.files;
});
Posted by: Guest on March-10-2022

Browse Popular Code Answers by Language