This is my first question on your forum, and I wish to find an answer, maybe it's a dumb question for everyone of you but I'm beginning with a JavaScript boot-camp and I'm curious how to do change the highlighted value with TamperMonkey
Another little question: Is there any macro recorder for TamperMonkey, like the one provided in Microsoft Office products to record a VB macro then edit it later?
HTML
<html class=" video videoautoplay">
<body data-no-turbolink="true">
<meta content="width=device-width,initial-scale=1.0,user-scalable=no"
name="viewport">
<meta id="fedora-keys" data-commit
sha="f232f03c4db92d93cff3bee17185864b56d67336" data-env="production"
TamperMonkey Script
(function() {
'use strict';
var link = document.createElement('meta');
link.setAttribute('name', 'data-env');
link.content = "development";
document.getElementsByTagName('head')[0].appendChild(link);
})();
I'm trying to change "production" to "development" with TamperMonkey, but I blame my ignorance of the programming language.
Regards
Try the following to change the element directly:
(function() {
'use strict';
//get the meta element with id fedora-keys
var link = document.querySelector('meta#fedora-keys');
//set the data-env attribute to development
link.setAttribute('data-env', 'development');
})();