Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <link href="" rel="stylesheet">


<body class="gradient">

 <div class ="burritoWrap">
  <h1> Shopping List </h1>
<select name = "Cathegory" id="dropDown" class="dropdown btn"> 
    <option value="uncategorised">Uncategorized</option>
  <option value="vegetables">Vegetables & Fruits</option>
  <option value="dairy">Dairy products</option>
  <option value="grains">Grains</option>
  <option value="meatFish">Meat & Fish</option>
  <input type="text" id="input" class="btn" placeholder="Enter Items" onsubmit="emptyText();"> </input>
<button id="add" class="btn"> Add </button>
  <button id="remove" class="btn" onlick ="return emptyText();"> Remove Last </button>

  <ul id="list">


</div> <!-- wrap -->



                .del {text-decoration: line-through;}

h1 {padding:5%; font-family: 'Open Sans Condensed', sans-serif; font-size: 40px; color: #7FA6FF}

.gradient {height:1000px;

#dropDown {margin-bottom:3%; font-family: 'Open Sans Condensed', sans-serif; font-size:20px;}

.burritoWrap {margin:0 auto; width: 500px; margin-top:8%; ; padding-bottom:5%; padding-top:1%; text-align:center; border-radius:5%; background-color:#061539; ; box-shadow:5px 5px  1px #162955;}

#add {margin-left: 2%; color:black; font-family: 'Open Sans Condensed', sans-serif; font-size:20px; background-color: #7FA6FF; margin-right:1%;}

#input{color:black; font-family: 'Open Sans Condensed', sans-serif; padding-right:10%; font-size:20px; }

#remove{color:black; font-family: 'Open Sans Condensed', sans-serif; font-size:20px; background-color: #7FA6FF; margin-left:1%}

.checked{float:right; color:black; font-size:15px; background-color: #7FA6FF;}

.liEl {; width: 250px; padding:2%; background-color:#734C8E; margin-left:8%; border-radius:5%; font-family: sans-serif; font-size:25px; color:whit;}


/* TODO. add stylying, make a drop down menu to select a cathgory, each cathegory change the appearance and colour of the line.. */ 


/* Function starting when pressing the button with the add id */
$(function () {
	$("#add").click(function() {
    /*var input: gets the value of the input field, that is the text entered in "Enter Items" box. 
    var check: creates a button of the class checked. 
    var newEl: creates a li element of the class liEl */
    var input = $('#input').val(); 
    var check = $('<button class="checked btn">Check</button>');
		var newEl = $('<li class="liEl"></li>');
 /* Appends the input value, the text, to the li element */
/* appends the check button to every new li */
 /* appends the newEls to the ul */   
 /* makes the input text box empty again after submitting an item */
  /* Adds an animation, but for now, to the wrong element */  
      newEl.addClass("animated bounce"); 

  /* If a category is selected, apply that css to the new li elements, a mix of jQuery and javascript to have an if/else*/
    if($("#dropDown").val() == "vegetables") { 
  $(newEl).css("background-color", "#5FAE57");
} else if ($("#dropDown").val() == "meatFish") {
  $(newEl).css("background-color", "#D3696C");
} else if ($("#dropDown").val() == "grains") {
  $(newEl).css("background-color", "#FFF7AA");
}else if ($("#dropDown").val() == "dairy") {
  $(newEl).css("background-color", "#7FA6FF");
  /* when the check button is pressed, the parent of this element, that is the Li element that is appended to and creates it, get this css style, in this case a line crossing it, otherwise all of the li elements would get crossed.*/
$(check).click(function() {
$(this).parent().css('text-decoration', 'line-through');

  /* remove the last liEl element */
   $('#remove').click(function(evt) {  
		var lastEl = $('li.liEl').last();
  /* This makes the Enter key work like the add button, the keycode for the enter key is 13 */
	 $('#input').keypress(function(evt) { 
		if (evt.keyCode === 13) {


/* Old code: 

document.getElementById("add").addEventListener('click', function() {

  var check = document.createElement("button");
  var input = document.getElementById("input").value;
  var newEl = document.createElement("li");
  var newText = document.createTextNode(input);
  var buttonText = document.createTextNode("Check");
  newEl.className = "liEl";
  check.setAttribute("class", "checked");

 $("button.checked").on('click', function() {

 var position = document.getElementsByTagName("ul")[0];
 document.getElementById("input").value = "";

document.getElementById('input').onkeypress = function(e) {
  if (e.keyCode == 13) {
    document.getElementById('add').click(); /*  adds an event listener to the submit text, keyCode 13 equals the enter key so when it's pressed it presses the add button. */

/* Delete last item function: */
document.getElementById("remove").addEventListener('click', function() {
  var els = document.getElementsByTagName("li");
  var removeEl = els[els.length - 1]; // <-- fetching last el, If els is an array, it has indices from 0 to els.length - 1. 0 is the first, els.length - 1 is the last index.
  var containerEl = removeEl.parentNode;

  document.getElementsByClassName("liEl").addEventListener("click", function(){
  var del = document.createElement("del");
    var liEl = document.getElementsByClassName("liEl");