Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8909377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:24:53+00:00 2026-06-15T03:24:53+00:00

the jquery function .textAnim does nothing textTyping_animation(); Works fine, but .textAnim doesn’t work. Here

  • 0

the jquery function “.textAnim” does nothing
textTyping_animation(); Works fine, but .textAnim doesn’t work.
Here is the plugin code:

function textTyping_animation(text,location,speed){
var progress = 0;
var a = setInterval(function(){
    progress++;
    document.getElementById(location).innerHTML = text.substring(0,progress);
    if(progress == text.length){
        clearInterval(a);
    }
},speed);
};
(function($){
$.fn.textAnim = function(text,speed){
    var progress = 0;
    var a = setInterval(function(){
        progress++;
        $(this).html(text.substring(0,progress));
        if(progress == text.length){
            clearInterval(a);
        }
    },speed);
};
})(jQuery);

Here is the execution:

$(document).ready(function(){
starttext = function()
{
    document.getElementById("textbox").style.display = "block";
    //textTyping_animation("Dit is een dummy text!","textbox_inner",70);
        $("#textbox_inner").textAnim("Dit is een dummy text!",70);
}
});

Html load code:

<script type="text/javascript" language="javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" ></script>
<script type="text/javascript" language="javascript" src="js/jqueryplugins.js" ></script>
<script type="text/javascript" language="javascript" src="js/libraries/gamelibrary.js"></script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:24:54+00:00Added an answer on June 15, 2026 at 3:24 am

    The problem is that this inside the callback function passed to setInterval() is the window, not the element you want it to be. Modify your code to save a reference to this inside the textAnim() function (which does refer to the correct element), then use that inside the callback passed to setInterval():

    (function($){
        $.fn.textAnim = function(text,speed){
            var progress = 0,
                element = this; // this will be the element in the jQuery object
            var a = setInterval(function(){
                progress++;
                $(element).html(text.substring(0,progress));
                if(progress == text.length){
                    clearInterval(a);
                }
            },speed);
        };
    })(jQuery);
    

    Here’s an updated DEMO.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why the JQuery function doesn't work while the ticker Updating the panel? Please see
This jquery function working fine for button submit but not working for link button.
The jQuery function below returns this string: '#prayer_date'.html(03/19/1968); But it doesn't get executed because
I have this jquery function that works, except I need to add something. I
i wrote a custom jquery function that accept a callback but not being able
The following JQuery function is not working entirely. IE 7 processes both alerts, but
Following is the simple jQuery function but I couldn't figure it out. <html> <head>
i am using this jquery function to display a pop window. in this code
my a click jquery function is not working, it just doesn't give any errors
Why does my jquery function runs twice on click ? $(a).click(processAction); function processAction(e){ var

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.