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

211
Views
Make words in placeholder while typing in javascript

I want to make do a typing accuracy check application. What I want to achieve is to make the words (user should type) in the placeholder or similar to the effects of placeholder while users are typing.

When user types the words in the input, the word in placeholder should disappear or fit the words in the input (user can't see it).

I have checked several other examples on stackoverflow, for example, but nothing helps me.

This the effect I want to acheiveenter image description here

Could anyone give me some ideas and solutions of how to solving this?

I have been struggled with this for a long time.

Thanks for any responds!

*Sorry, my english sucks. I want to something like this in this website

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Take a look at this. https://jsfiddle.net/dgstcu0y

Summary of what I tried here is below :

  1. I add event listener that will take input and insert into our div which is like custom input.

    const input = document.getElementById("input") const content = document.getElementById("content")

    input.addEventListener("input",(event)=>{
        const value = event.target.value
      content.innerHTML = value
    })
    
  2. Then, I make the input transparent. But the problem is it also make the cursor transparent. So, I tried to add | after our custom-input div.

  3. Using CSS I tried to to overlap our custom div with generic input.

    .wrapper { position: relative; width: 300px; } #input { color: transparent; padding: 0; background: transparent; } .custom-input { position: absolute; top: 0; color: grey; z-index: -1; } #content:after { content:"|" }

Here is HTML skeleton.

<html>
<body>
<div class="wrapper">
  <input id="input">
  <div class="custom-input">
    <span id="content"></span>
    <span>My Suggestions</span>
  </div>
</div>
</body>
</html>

Customize it according to your need.

about 4 years ago · Santiago Gelvez 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!