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

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

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 Report

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 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!