简体   繁体   中英

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. So please if anyone has any idea please share.

What I want to do:

  • Have an Input box in html file.
<input type="text" id="paste" placeholder = "paste text">
  • Have whatever value input get sent to a inject.js file.

PS this is for a google extension so bear that in mind.

Seems you can use a content script to monitor this iuput box, such as

document.querySelector('input').addEventListener('input',function(){...executer...})

And then every time the input text is changed, you can do something in executer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM