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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:32:04+00:00 2026-05-29T20:32:04+00:00

I have a problem with the use of the javascript removeChild function. Here’s my

  • 0

I have a problem with the use of the javascript removeChild function.
Here’s my script:

    ////function to add element by ID////
        var i=1;
        $("#buttonAdd").live('click',function() { 
        $("#list1 li:last-child").parent().append('<li>'+
                                                    '<label for=njajal[]>njajal'+
                                                    '<textarea  class="tinymce" name="njajal[]" id="aaa'+i+'"></textarea>'+
                                                    '<span><a class="delIt" id="'+i+'"><b>Hapus</a></span></label>'+
                                                '</li>');
        tinyMCE.execCommand('mceAddControl', false, 'aaa'+i);
        console.log('add '+i);
        i++;
    }); 

    ////Function to delete element by ID/////
    function delIt(eleId)  
    {
        d = document;  
        var ele = d.getElementById(eleId);  
        var parentEle = d.getElementById('njajal');  
        parentEle.removeChild(ele);  
    }

What is the problem?

Here’s the HTML code:

<div id="form">
    <form method="post" action="">
        <fieldset>
            <ol id="list1">
                <li>        
                    <label for="njajal[]">njajal
                        <textarea name="njajal[]" class="tinymce" ></textarea>
                    </label>
                </li>
            </ol>
            <div id="addOpt">
                <a id="buttonAdd" class="bt"><b>Tambah</a>
            </div> 
        </fieldset>
    </form>
</div>

Screnshot:
enter image description here

  • 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-05-29T20:32:07+00:00Added an answer on May 29, 2026 at 8:32 pm

    You use jQuery in your first function, so the easiest way to remove that element would be with jQuery:

    $('#myElementID').remove();
    

    Here’s how you can accomplish the same thing with plain javascript:

    var myElement = document.getElementById('myElementID');
    myElement.parentNode.removeChild(myElement);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with a bash script. I have to use the operator
I have a problem with my layout, i use javascript to get a xml-file
Duplicate of: Use javascript to inject script references as needed? Javascript doesn't have any
I have problem with ajax loader image when I use the load() function, the
I have had a problem in firefox (using 10.0.2) trying to use javascript to
I have problem with SharePoint encoding the javascript link, that normally renders like href=javascript:Function('url');
i have problem use link_to_remote link_to_remote document example say link_to_remote Delete this post, :update
I have found a problem with use JQuery timeout, i have a page with
I have problem with setting proper charset on my jsf pages. I use MySql
In a couple of scripts that I use I have problem that is intermittent.

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.