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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:14:02+00:00 2026-05-12T08:14:02+00:00

Hai I am doing a web page. In that there is a drop down

  • 0

Hai

I am doing a web page. In that there is a drop down contains some products, when we select an item it will display below with a remove button as dynamically. My problem is that al the products removed correctly but a product that has product id 5 is not removed? What’s the problem? Below is my code

<script type="text/javascript>
function validate(frm_name){
var hiddenFeild = document.getElementById('product');
var addedItems = hiddenFeild.value;
var brokenItems = addedItems.split(",");
    if(isEmpty(hiddenFeild.value)){
        alert("No Product Added.");
        return false;
    }
    if(brokenItems.length < 3){
        alert("Please Add One More Product.");
        return false;
    }
    return true;
}
function removeme(id){
compareDiv = document.getElementById('compare_product');
var remDiv = document.getElementById(id);
compareDiv.removeChild(remDiv);
var hiddenFeild = document.getElementById('product');
var addedItems = hiddenFeild.value;
var brokenItems = addedItems.split(",");
hiddenFeild.value = '';
for(var i = 0 ; i < brokenItems.length-1; i++){
    if(brokenItems[i] != id){
        hiddenFeild.value = hiddenFeild.value +brokenItems[i]+',';
    }
}
}
function selectProduct(){
    var flag = 0;
    compareDiv = document.getElementById('compare_product');
    var proValue = document.getElementById('frm_product').value;
    if(proValue != 0){
        var product = proValue.split("productvalue");
        var productid = product[0];
        var productname = product[1];
        var hiddenFeild = document.getElementById('product');
        var addedItems = hiddenFeild.value;
        var brokenItems = addedItems.split(",");
         for(var i = 0 ; i < brokenItems.length; i++){
                    if(brokenItems[i] == productid){    
                        flag = 1;
                        alert('Already Added');
                    }
        }
        if(flag == 0){
            hiddenFeild.value = hiddenFeild.value +productid+',';
            compareDiv.innerHTML = compareDiv.innerHTML + '<div id="'+productid+'" style="height:30px;"><div style="float:left;" id="added_product">'+productname+'</div><div style="float:right;"><input onClick="removeme('+productid+');" id="remove" name="remove" type="button" value="remove" /></div></div>';
        }
    }
}

</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-05-12T08:14:02+00:00Added an answer on May 12, 2026 at 8:14 am

    In general removeChild has to be called from the parent node of the node that should be removed. So try this:

    function removeme(id) {
        var remDiv = document.getElementById(id);
        remDiv.parentNode.removeChild(remDiv);
        // …
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hai guys, I want to upload images through my web page to a folder
Hai, I am doing one application, in that i want to provide the shadow
Hai All... I want to change the uipagecontroller indicator(dot) color...For that i'm doing the
Hai, I done a server program in vc++(using visualstudio 2008). At that time it
Hai I am having a form which contains a filetype like this <tr><td> <input
Hai Friends., Im doing a project on Airline Reservation.In my project i have a
Hai guys, Is there any alternative for windows scheduler for an asp.net application... The
Hai Guys, Like DataAccessApplicationBlock for .net with sql server,Is there any thing for MySql
Hai I want to build a web site containing chat. i am working with
Hai I used basic code for adwhirl to display ads by using AdWhirl. I

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.