76 339
Assignments Done
Successfully Done
In May 2019

Answer to Question #47452 in AJAX | JavaScript | HTML | PHP for John

Question #47452
I need a JS Code to Work with the following HTML Code:
<!DOCTYPE html>
<title>Shopping List</title>
<script type="text/javascript" src=""></script>
<p>Use the field below to add items to your shopping list.</p>
<input type="text" name="txtItem" id="txtItem" placeholder="Enter an Item" />
<br />
<br />

<button onclick="AddItem();">Add Item</button>
<button onclick="RemoveLastItem();">Remove Last Item</button>
<div id="printedList"></div>

I came up with this:
var shoppingList = ['Milk', 'Eggs', 'Bread'];
var outputDIV = document.getElementById('printedList');

function AddItem(){
document.getElementById('printedList').innerHTML = shoppingList;
function RemoveLastItem(){
document.getElementById('printedList').innerHTML = shoppingList;

I need to to have it to involve this:

shoppingList.push('item to add');


and lastly the ouputDIV

outputDIV.innerHTML = shoppingList.toString();
Expert's answer

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions