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

211
Visualizações
How to fill text field using JavaScript?

I am trying to open a webpage from my JavaScript function:

function fillText() {   
      window.open("https://Somerandonwebsite.com/task");      
  }

The webpage : "https://Somerandonwebsite.com/task" has a text box with the following tag:

<input type="text" id="titleBox" autocomplete="off" aria-label="Title Field" title="" placeholder="Enter Title" aria-invalid="true">

I want to add string "Title created" to the text box with the id titleBox

How can I achieve this in the function? I am also confused whether to add the string first and open webpage or open webpage and access text box to fill my string

How can I access text box to fill this string into the text box on opening web page?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

As @Carsten Løvbo Andersen's comment said if you own both sites, you can just pass some query strings from your function to your site. E.G.

function fillText() {   
  window.open("https://Somerandonwebsite.com/task?string=yourString");
}      

Then, at your Somerandonwebsite.com, simply create a script:

var input = document.getElementById("titleBox");
const params = new URLSearchParams(window.location.search)
input.value = params.get("string")

This will make your text box display your query string named string

about 4 years ago · Juan Pablo Isaza Relatório
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