I would add a button before the posting field (a textarea) but it's not working. The button will generate some preset texts.
The script works in console, but not working in tampermonkey userscripts. Can someone help me fix it?
// ==UserScript==
// @name canva generate
// @namespace http://canva.com
// @version 0.1
// @description generate some preset texts in the canva.com textarea
// @author You
// @match https://www.canva.com/*
// @icon https://www.google.com/s2/favicons?domain=tampermonkey.net
// @grant none
// ==/UserScript==
(function() {
'use strict';
let target = document.getElementsByTagName("textarea")[0].parent;
alert(target);
// create new element
const elem = document.createElement('button');
// add text
elem.name = 'generate';
// insert the element before target element
target.insertBefore(elem, target);
})();
Image of canva.com posting in upper right corner: