[英]How can I pass a value from an input box (html file) to a javascript inject file (inject.js)?
I am wondering if there is a way to pass a value from a input box to another file (html to javascript) (Been stuck on this for couple days now and it's driving me insane) the problem with this is that it is a inject file and I think they don't work in the same fashion as other js files.我想知道是否有一种方法可以将输入框中的值传递到另一个文件(html 到 javascript)(已经被困在这个问题上几天了,这让我发疯了)问题是它是一个注入文件而且我认为它们的工作方式与其他 js 文件不同。 So please if anyone has any idea please share.因此,如果有人有任何想法,请分享。
What I want to do:我想做的事:
<input type="text" id="paste" placeholder = "paste text">
PS this is for a google extension so bear that in mind. PS这是一个谷歌扩展所以记住这一点。
Seems you can use a content script to monitor this iuput box, such as似乎您可以使用内容脚本来监视此 iuput 框,例如
document.querySelector('input').addEventListener('input',function(){...executer...})
And then every time the input text is changed, you can do something in executer然后每次输入文本改变时,你可以在执行器中做一些事情
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.