Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

179
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!