Pawan_Agarwal Posted August 1, 2013 Share Posted August 1, 2013 Developing CART for Online Shopping I am trying to add buttons on html page and the code is working............I have some products in <SELECT> tag i.e. Product 1,Product 2,Product 3,Product 4,Product 5......... I create an array "list_array" and storing all the values in array dynamically... I click on <BUTTON>ADD </BUTTON> and it reads the value from <SELECT> tag and add it into array...........To display all the products, I execute the loop and display all the items in array with a <BUTTON>REMOVE</BUTTON> in-front of every product.......... To delete the particular product, I can select it in <SELECT> tag and then click on delete button..........It removes the element from array .........To display the cart, I am using the loop again, and it shows all the products after clicking the <BUTTON>Display</BUTTON> Now the issue that I am facing here is that I am adding <BUTTON>REMOVE</BUTTON> button when I am displaying the products that have been added in CART, the code of java_script is listed below function display() { string = ""; str=""; for(j=0;j<i;j++) { str = list_array[j]+"_"+j; string = list_array[j]+" <button onclick='remove_me(this)' id="+str+">Remove</button><br>"+string; } document.getElementById('write').innerHTML = "Array:<br> " + string; document.getElementById('i_val').innerHTML = "I: " + i; } Now, I am trying every way to make a code that will help me in removing the product by clicking on <BUTTON>REMOVE</BUTTON>, I hope I have explained everything here, so, help me to fix this issue............... Quote Link to comment https://forums.phpfreaks.com/topic/280704-cannot-remove-the-button-that-i-have-added-on-page/ Share on other sites More sharing options...
Pawan_Agarwal Posted August 5, 2013 Author Share Posted August 5, 2013 I have tried to explain each and every aspect , I am still wondering why no one is replying to this post............ Quote Link to comment https://forums.phpfreaks.com/topic/280704-cannot-remove-the-button-that-i-have-added-on-page/#findComment-1443581 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.