I'm now to coding so sorry if my question is dumb. I'm trying to code an extension getting information from the html of some websites, and then display the info I got on the popup of the extension. The problem is, when I can't communicate between the foreground.js and the html of the popup. Here is the popup file,
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>`
<style>
body {
display: flex;
flex-flow: row wrap;
justify-content: last baseline;
align-items: center;
}
</style>
</head>
<body>
<h2>Welcome to LISTOKADO</h2>
<a href="https://www.listokado.com/" title="lien html">
<img alt="listokado" src="./logoListo-2.png" width="64" height="64" />
</a>
<a>
<img alt= 'Choisissez un article'id="imgAchatEnCours" src="" width="64" height="64">
</a>
<p> <input type="submit" value="Add to wishlist" />
</p>
<script src="jquery.js"></script>
<script type="text/javascript" src="im_achat.js"></script>
</body>
</html>
And here the foreground.js :
console.log(document.getElementsByClassName('a-offscreen')['6'].innerText)
console.log(document.querySelector('#productTitle').textContent)
var img_achat = new Image
img_achat = document.querySelector('#imgTagWrapperId img').src
localStorage.setItem('img_achat_en_cours',img_achat)
console.log('im chargée dans le localstorage')
//document.addEventListener('DOMContentLoaded',() => {
const recentImageDataUrl = localStorage.getItem("img_achat_en_cours")
console.log(recentImageDataUrl);
if(recentImageDataUrl){
//console.log('test allo')
Document.getElementById('#imgAchatEnCours').setAttribute("src",recentImageDataUrl)
console.log('si ça saffiche cest que cest bon');
}
//});
How can I modify the src of the image 'imgAchatEnCours' in the html of the popup? is there an equivalent to Document.getElementById() like popup.getelement() or something? Because I understood that I'm searching in the web page so I don't modify what i want
Thank you for reading