I'm trying to make my own user script for https://mlwbd.ltd/movie/don-2022
I wish to copy the value of specified hidden input
preTag = document.getElementsByName("FU");
p = preTag[0];
console.log(p);
Ekra = document.getElementsByClassName("linktabs");
q = Ekra[0];
console.log(q);
function copy(ele) {
let temp = document.createElement('textarea');
document.body.appendChild(temp);
temp.value = ele.textContent;
temp.select();
document.execCommand('copy');
temp.remove();
}
btn = document.createElement("button");
btn.innerHTML = "copy"
btn.onclick = function(){
copy("p");
};
q.insertBefore(document.createElement("br"), q.childNodes[0])
q.insertBefore(btn, q.childNodes[0])
The Html code is
input type="hidden" name="FU" value="https://songslyric.site/links/46905/"I want to copy the Value of name="FU" when I click the button. The code I pasted is created from google chrome snippets. Please help me.