cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div class="container">
  <h1>TODO</h1>
  <form id='todoForm' action="#">
    <fieldset>
      <label for="item">Add Item</label>
      <input type="text" name="item" id="item" placeholder="Be awesome" autofocus required />
      <input type="submit" id='submit' class='button' value="Submit" />
    </fieldset>
  </form>  
  <ul id='todoList'>
  </ul>  
</div>
<footer class="container">
  <p>A simple single-page ToDo app using only jQuery, CSS and HTML.</p>
  <p>by <a href="https://jannypie.github.io">Jan Dennison</a></p>
</footer>
            
          
!
            
              /* font */
@import url(https://fonts.googleapis.com/css?family=Oswald:400,300);

/* base */
html {
  box-sizing: border-box;
}
*, *:before, *:after {
  box-sizing: inherit;
}
body, input[type='text'], #submit {
  font-family: 'Oswald', sans-serif;
  letter-spacing: 0.05em;
}
body {
  background:
linear-gradient(-45deg, white 25%, transparent 25%, transparent 75%, silver 75%, silver) 0 0,
linear-gradient(-45deg, silver 25%, transparent 25%, transparent 75%, white 75%, white) 1em 1em,
linear-gradient(45deg, silver 17%, transparent 17%, transparent 25%, silver 25%, silver 36%, transparent 36%, transparent 64%, silver 64%, silver 75%, transparent 75%, transparent 83%, silver 83%) 1em 1em;
background-color: white;
background-size: 2em 2em;
}

.container {
  background: white;
  border: 1px solid silver;
  margin: 2em;
  padding: 2em 2em 6em 2em;
}

fieldset {
  border: 0;
  padding: 0;
  margin: 2em 0;
}
label {
  color: gray;
  display: block;
  font-size: 0.8em;
  text-transform: uppercase;
}
input[type='text'] {
  display: inline-block;
  font-size: 1.2em;
  padding: 0.2em;
  width: 50%;
}
#submit.button {
  -webkit-border-radius: 0;
  border-radius: 0;
  border: 2px solid gold;
  color: white;
  font-size: 1.2em;
  padding: 0.2em;
  background: gold;
}
#submit.button:hover {
  background: goldenrod;
  border-color: goldenrod;
}

ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

li {
  background: whitesmoke;
  border-left: 4px solid gold;
  color: charcoal;
  font-size: 1.4em;
  padding: 0.2em 0.4em;
  margin-bottom: 0.2em;
}

a {
  color: gold;
  text-decoration: none;
}

@media (min-width: 480px) {
  .container {
    margin: 2em auto;
    width: 90%;
  }
}
            
          
!
            
              var todoItems = [];
var todoList = $('#todoList');

function renderTodoList() {
  $(todoItems).each(function(index,item) {
    todoList.append("<li>" + item + "</li>");
  });
}

function updateListView(item) {
  todoList.append("<li>" + item + "</li>");
}

function saveItem(item) {
  todoItems.push(item);
}

$(document).ready(function() {
  renderTodoList();
  
  $('#todoForm').submit(function(e) {
    e.preventDefault();
    var item = $(this).find('#item').val();
    saveItem(item);
    updateListView(item);
    this.reset();
  });
});
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console