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

172
Visualizações
How do I autofill a textbox with data I just clicked with href?

enter image description hereIf I click on sender 'haq', how can I redirect to the messaging page and autofill 'haq' into the username text box?enter image description here

My code with the href is below:

return (
    <html className="u">
    <div className="form-container">
        <h1 className="message-text">Inbox</h1>
        <table className="table-box">
            <tr>
                <th>Sender </th>
                <th>Message</th>
            </tr>

            {messageList.map((val,key) => 
            {
                return (
            

            <tr>
                <a href = {"http://localhost:3000" + "/Message"}><td>{val.Sender}</td> </a>
                <td>{val.Message}</td>
            </tr>
                );
            })}
        </table>
    </div>
    </html>
);   

}

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

0

You have to get the value of the parameter message (How to do that). Then after getting the value, assign it to the textbox.

Example:

// Get value of parameter in URL
let example_url = "http://www.example.com/message=helloWorld"; // window.location.href
let url = new URL(example_url);
let message = url.searchParams.get("message")

// Assign value to textbox
document.getElementById("textbox").value = message;
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