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

302
Views
Textarea with overlay: hide text in textarea

I would like to display an overlay over textarea to display formatted input (textarea does not support tags inside). For now I'm able to pass text that inputed into text area to overlay div but I could not hide text in textarea and it bothers:

    overlay = document.getElementById('overlay')
    query_template = document.getElementById('query_template')
    query_template.addEventListener('input', (e) => {
        console.log(query_template.value);
        overlay.innerText = query_template.value;
        query_template.innerHTML = query_template.value;
    })
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        div{
            border:1px solid transparent
        }
        div,
        textarea {
            position: absolute;
            width: 300px;
            height: 200px;
            top: 0;
            left: 0;
            font-size: 1em;
            line-height: 1em;
        }
    </style>
</head>
<body>
<body>
<div class="parent">
    <div id="overlay" style="color: #1a1a1a"></div>
    <textarea id="query_template" style="color: white; background: transparent"></textarea>
</div>
</body>
</body>
</html>

How can I hide text in textarea?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

u can set

textarea{
color:transparent;
} 
about 4 years ago · Juan Pablo Isaza Report

0

Try opacity.

textarea {
    opacity: 0;
}
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!