Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

179
Visualizações
Chrome Extension JavaScript no inserta valor en la etiqueta de párrafo

Hola, estoy aprendiendo a crear una extensión de Chrome v3 y tengo problemas para insertar texto en un párrafo. He intentado insertar un documento.getelementbyid que no parece funcionar. También he intentado usar un documento.cuerpo. innerHTML que funcionó pero mostró el valor en el cuerpo de la página y no en el cuerpo de la extensión de Chrome

Manifiesto.JSON

 { "manifest_version": 3, "name": "Stader HBAR Staking", "version": "0.1", "action": { "16": "/images/HBARLogo.png", "48": "/images/HBARLogo.png", "128": "/images/HBARLogo.png", "default_popup": "popup.html" }, "description": "This extention works with Stader Hedera staking to get the amount of reward you have recieved so far.", "icons": { "16": "/images/HBARLogo.png", "48": "/images/HBARLogo.png", "128": "/images/HBARLogo.png" }, "content_scripts": [ { "matches": ["https://hedera.staderlabs.com/lt-pools"], "css": ["style.css"], "js": ["background.js"] } ] }

Archivo JavaScript

 setTimeout(function (){ let amount = document.querySelector(".bg-dark-600 > .flex > .flex-center > .LSPoolsEstimate_value__jdEKi").innerHTML; let currentAmount = document.querySelector(".MuiGrid-root > .flex-center > .LSPoolsForm_root__XqBrI > .LSPoolsForm_container__hcfZ2 > .LSPoolsFormLaToLx_root__DP9bV > form > .LSPoolsFormLaToLx_available_amount_validation__jOOGH > .flex:nth-child(2) > .Typography_root__nvhLo").innerHTML; removingFirstItem = currentAmount.split("~").pop(); removingSecondItem = removingFirstItem.split("HBAR").shift(); currentValue = removingSecondItem.trim(); console.log(amount); let doCalculation = amount * currentValue; console.log(doCalculation); let youHaveEarned = doCalculation - amount; console.log(youHaveEarned); document.getElementById("initialAmount").innerHTML = totalAmountEarned }, 2000)();

Archivo HTML

 <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="style.css"> </head> <body> <div class="bodyofex"> <p id="initialAmount"></p> </div> <script src="./background.js"> </script> </body> </html>
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda