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 9143651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:04:38+00:00 2026-06-17T10:04:38+00:00

How can you transfrom this from jquery library into pure javascript? function appendText(){ var

  • 0

How can you transfrom this from jquery library into pure javascript?

function appendText(){
    var text = $("#text").val();

    if ( $("#text").val() ){
    var textArea = "<div class='divex'> <li style='list-style-type:none;' id='t"+counter+"'>"+text+"</li><button id='b"+
    counter+"'name='t"+counter+"' >edit</button></div>";    
    $("#text").val();
    $("#addedText").after(textArea);
    $("#t"+counter).clear;    
    $("#t"+counter).attr('readonly','readonly');
    $("#b"+counter).bind('click',makeAreaEditable);
    $("#text").val('');
    $('.divex').sortable();                                                 
    counter++;
    }
    else{
    }   
};  

for the start i tried something like this:

var counter=0;
function appendText(){
    var text = document.getElementById('text');

    if ( document.getElementById('text').value ){
    var textArea = "<div class='divex'> <li style='list-style-type:none;'id='t"+counter+"'>"+text+"</li><button id='b"+
    counter+"'name='t"+counter+"' >edit</button> </div>";

    var texty = document.getElementById('addedText').appendChild(textArea);

but i have some problems.

I think i didn’t atribue the text to the list corectly.. Here is what
i’ve got so far:

 var counter=0;
    function appendText(){

        var text = document.getElementById('text').value;

        if ( document.getElementById('text').value ){   
        var div = document.createElement('div');
        div.class = 'divex';
        var li = document.createElement('li');

        div.appendChild(li);
        document.createTextNode(text);

        var bigdiv = document.getElementById('addedText');
        bigdiv.appendChild(text);

        counter++;
        }
        else{
        }   
    };
  • 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-17T10:04:39+00:00Added an answer on June 17, 2026 at 10:04 am

    .appendChild() expects a DOM element, not a HTML string like you have in your textarea variable.

    You have to use document.createElement first, something like:

    var div = document.createElement('div');
    div.class = 'divex';
    var li = document.createElement('li');
    div.appendChild(li);
    // etc.
    

    Then use document.createTextNode() to create the text inside the li-element. And so on..

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

Sidebar

Related Questions

I tried following this http://net.tutsplus.com/tutorials/javascript-ajax/an-introduction-to-the-raphael-js-library/ tutorial, but it does not work exactly with Raphael
How can I transform this table from this id name 1 sam 2 nick
I am retrieving HTML from a remote host with the following jQuery code var
how can I make text draw vertically, like in this site: http://cure.org/help-now/ ? I
How can I transform the following XML with XSLT from this: <root> <list> <item
How can I do a Redirect Rule that transforms this URL: http://localhost/app/Company/HomePage.aspx?COMPANYID=2&FORCESHOWCASE=TRUE&THEMEPREVIEW=3 to this
In SQL server How can I transform 1 row with varchar columns into a
Can I get Visual Studio to transform the built-in aliases into the System types?
I could be misunderstanding what is happening but from what I can tell I
How can I transform jQuery carousel to show 3x3 square of images instead of

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.