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

157
Visualizações
Javascript Insert text inside "<>" input

How i can insert dinamically something like "refer" inside my <> input tag, without writing it directly into html but using javascript? Something similar to

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

0

you can use setAttribute for this action

var i = document.querySelector("input");

i.setAttribute("name", "myinput");

ref: https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute

about 4 years ago · Juan Pablo Isaza Relatório

0

Supposing you have this 👇

<input type="text" value="23" id="age"> </input>

You can select that element by

const ageInput = document.getElementById('age');

If what you want is to change the text inside you can do this by

ageInput.innerHTML = "Hello World"

Or you can set a new attribute by

ageInput.setAttribute("refer", "true");

setAttribute documentation 👉 https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute

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