Я получаю сообщение об ошибке при попытке выполнить функцию copyToClipboard в моем расширении chrome.Я не знаю, почему я получаю эту ошибку, потому что я создал другой js-файл для запуска функции и включил его в html-файл.
Ошибка следующая
function copyToClipboard() {
/* Get the text field */
var clearing = 'Hola chicos'
/* Select the text field */
clearing.select();
/* Copy the text inside the text field */
document.execCommand("copy");
/* Alert the copied text */
}
<body>
<div class="modal-header">
<h1 class="logo">
<img src="images/meli-logo.png" alt="" class="logo-icon" style="width: 100px; height: 100px;"> ML Template Test
<div class="version">(1.0.0)</div>
</h1>
</div>
<div class="dropdown">
<button class="dropbtn">Retiros</button>
<div class="dropdown-content">
<button onclick="copyToClipboard()">Clearing</button>
</div>
</div>
</body>
И это мой манифест
{
"manifest_version": 2,
"name": "MeliTemplates",
"version": "1.0.0",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"permissions": ["activeTab", "storage"]
}