[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


How to simulate typing using jQuery?

Posted on 2011-09-11
Medium Priority
Last Modified: 2012-08-13
I have a div in html:

Open in new window

I just want the characters to appear one at a time from left to right. I'm using VWD. I thought the easiest way to do it was by usig jQuery but I'm open to suggestions.
Question by:WhyDidntItWork
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 82

Accepted Solution

leakim971 earned 2000 total points
ID: 36520311
Test page : http://jsfiddle.net/CuhCK/
var s = "1234567890".split("");

var t = setInterval(function() {

    // get the next char from s, remove it from s, and append it to the current content       
    document.getElementById("one_at_time").innerHTML += s.shift();
    // or with jQuery :
    //$("#one_at_time").html( $("#one_at_time").html() + s.shift() );

    // if there's no more char to display stop the timer
    if(s.length==0) clearInterval(t);

}, 1000); // each 1s (1000ms)

Open in new window

<div id="one_at_time"></div>

Open in new window


Author Closing Comment

ID: 36520636
It's beautiful. It's a work of art.

Thanks for aching me about the split and shift methods.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question