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

175
Views
HTML, Pure Javascript | How to make an element follow the text freshly entered

I am trying to create an effect in which a circle follows the new entered text

Like: As I type 'H', the circle is behind it, then when I press 'e', the text now visible is 'He' but the circle is behind 'e' now. And this process continues.

The text will be entered in a <textarea> and this text coveres half the page.

This is a website and If possible please give the answers with HTML, CSS and Vanilla JS as I haven't learnt JQuery or any other Framwork, Library, etc.

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

0

In a textarea element I think it is not possible without further ado. But you can use an input element instead. I have built a small prototype that shows you how to do it.

const op = document.querySelector('.output');

function make() {
  const ta = document.querySelector('#textarea input');  
  op.innerHTML = ta.value;
  const nw = ta.value.length < 1 ? 1: ta.value.length;
  
   ta.size= parseInt(nw);
}
.w {
  text-align: center;
}

.output {
  background: lightgray;
  font-size: 10px;
  border-radius: 25px;
  padding:5px;
  margin-bottom: auto;
}

#textarea{
  border:1px solid #eee;
  display: flex;
  gap: 10px;
}

#textarea input{  
  border:none;
  background:none;
  font-size:1.2em;
  padding:6px;
}

#textarea input:focus{
   outline:none;
}
  <div id="textarea" oninput="make()">
    <input size="1" type="text" value=""/>
    <div class="output"></div>  
   </div> 
  

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!