I want to create a Paste button (id : paste) in my extension's popup.html window, which should paste the contents of the clipboard into a text field (id : inpt) in the same window
document.addEventListener('DOMContentLoaded', function() {
var paste = document.getElementById('paste');
paste.addEventListener('click', function() {
navigator.clipboard.readText()
.then(txt => {
document.getElementById("inpt").value = txt;
})
});
});
I did the following code but without success