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 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 Techies, I have some stored procedure which was written in SQL server.Now i
Hai all, Am using DevExpress LookupEdit in C#.NET project,also set both Display Member and
Hai in vc++6.0 MFC, i connected a serial port, while reading and displaying a
public enum myEnum { VAL1(10), VAL2(20), VAL3(hai) { public Object getValue() { return this.strVal;
I have used this in my HTML: <q> Hai How r u </q> Which
hai Friends I am using this coding for validating the emailID online through webservice
Hai Friends I am using webservice for validating the Email in the Online Its
hai friends I am one dataset like this ds like three columns this: tblkey
hai friends I am using a file upload control to upload the files if
hai i a'm trying to create a sqlite database programmatically at the run time.

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.