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

  • Home
  • SEARCH
  • 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 8265565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:51:09+00:00 2026-06-08T04:51:09+00:00

I have an input field. When the user clicks it some javascript converts the

  • 0

I have an input field. When the user clicks it some javascript converts the text to a Raphael JS library variable. I want to put each letter into a Raphael variable called string followed by a \n. When the user clicks on the button nothing is displayed. Can someone help me fix this?…

    <html> 
    <head> 
    <script src="raphael.js"></script> 
    <script src="jquery-1.7.2.js"></script>  
    <script type="text/javascript">   
    var string = "";
    function animate() {  

    var txt = document.getElementById("words").value;
    var splittxt = txt.split("");

        var i;
        for (i = 0; i < splittxt.length; i++) {
        var string = splittxt[i] + "\n\n";

        }
        }      

        </script>
        <style type="text/css">
        #letters
        {
        text-align:center;
        margin-left:10px;
        width:25px;
        float:left;
        text-shadow:10px 5px 1px #4D4D4D;
        filter:DropShadow(Color=#4D4D4D, OffX=10, OffY=5);
        font-weight:bold;
        }

        </style>

        </head> 

        <body>  

        Text: <input type="text" id="words"  /> 
        <input type="button" value="Animate" onclick="animate()" /> 
        <div id='letters'></div>
        <div id="draw-here-raphael" style="height: 200px; width: 400px; margin-top:0px; background-color:blue;"> 
        </div> 
        <div id="elps" style="ma

rgin-left:100px;"/>  

    <script type="text/javascript"> //all your javascript goes here  
    var r = new Raphael("draw-here-raphael");  
    var string = r.text(50,50, string);
    </script>

    </body> 
    </html>
  • 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-08T04:51:12+00:00Added an answer on June 8, 2026 at 4:51 am

    Instead of setting the variable string, you want add to it. Also, there were quite a few other updates I made to your excerpt…

    Setting variables to reserved words can also cause a lot of problems.

    http://jsfiddle.net/fN9Me/

    <html> 
        <head> 
        <script src="raphael.js"></script> 
        <script src="jquery-1.7.2.js"></script>  
        <script type="text/javascript">   
            var alpha = "";
            var something = "";
            var r = "";
            var txt = "";
            var splittxt = "";
    
            $(function() {
                r = new Raphael("draw-here-raphael");
    
                $("#animate").click(function() {
                    txt = $("#words").val();
                    splittxt = txt.split("");
    
                    var i;
                    for (i = 0; i < splittxt.length; i++) {
                        something += splittxt[i] + "\n\n";
                    }
                    alpha = r.text(50, 50, something);
                });
    
            });
        </script>
        <style type="text/css">
        #letters
        {
        text-align:center;
        margin-left:10px;
        width:25px;
        float:left;
        text-shadow:10px 5px 1px #4D4D4D;
        filter:DropShadow(Color=#4D4D4D, OffX=10, OffY=5);
        font-weight:bold;
        }
    
        </style>
    
        </head> 
    
        <body>  
           Text: <input type="text" id="words" value="" />
            <input id="animate" type="button" value="Animate" />
            <div id='letters'></div>
            <div id="draw-here-raphael" style="height: 200px; width: 400px; margin-top:0px; background-color:blue;">
            </div>
            <div id="elps" style="margin-left:100px;"/>  
        </body> 
    </html>
    

    Update:

    To remove the previous text, it is just a matter of utilizing the Raphael remove function. Also we have to reset the variable something

    if (alpha) alpha.remove();
    

    http://jsfiddle.net/fN9Me/1/

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

Sidebar

Related Questions

I have an input edit field where the user can enter data. I want
I have an input field which has a placeholder text. I want one word
I have a text input field that has some sample text in a light
For some reason i have to put all input field into array.Because the input
I have an input field with some pre defined text explaining what it is
I have a form with a few input fields. When a user clicks on
TABLE bcompany companyID | cName | ... I have the input field, where user
I have one input field and one division with span children <input type=text id=input
I have an input field that is by default set to type=text so that
I have an input field and I want to limit it to alphanumerical (A-Z,

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.