Pen Settings

HTML

CSS

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

JavaScript

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

Behavior

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.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

            
              <head>
  <link href="https://fonts.googleapis.com/css?family=Exo" rel="stylesheet">

</head>

<div class="container">
 <div class="row">
   <div class="col-12">
     <div class="intro" >
       <h1>Work To DO</h1>
     </div>
   </div>
  </div>
  
   <div class="instructions">
     <p>Enter text into input field</p>
     <p>Then hit enter!</p>
     <p #third>Use Buttons to Remove or Complete Item</p>
   </div>
  </div>
  
    <input id="userInput" type="text" placeholder="New item" maxlength="27">
  </div>
<button id="enter" type="button"> <i class="fa fa-pencil" aria-hidden="true"></i>
</button>

 <div class="listItems col-12 col-sm-12">
				<ul id="todo" class="todo">
          <li>This is an example item
            <div class="buttons" id="buttons">
              <button class="Remove"><i class="fa fa-trash" aria-hidden="true"></i>
</button>
              <button class="Complete"><i class="fa fa-check" aria-hidden="true"></i>
</button>
            </div>
          </li>
          
				</ul>
			</div>
		</div>

  
  
  
   
  
  
 

<script type="text/javascript" src="script_method3.js"></script>
            
          
!

CSS

            
              body {
  
  text-align: center;
  margin-top: 30px;
  background: #1EEBF8;
  
}

.intro {
  font-family: Sans-serif;
  font-size: 35px;
  font-color:  ;
}
.instructions {
  
  font-size: 25px;
  font-weight: 800;
  font-color: ;
}
h1 {
  font-family: 'Source Code Pro', monospace;
  font-size: 55px;
  font-weight: 1000;
  text-transform: uppercase;
  color: ;
}

p{
  font-weight: 300;
  font-family: 'Source Code Pro', monospace;
}

input {
  border-radius: 5px;
  border-color: black;
  padding-right: 200px;
  padding-left: 10px;
  padding-bottom: 3px;
}


#enter {
  margin-left: 15px;
  border-radius: 5px;
  padding: 10px 20px;
  color: #04A1BF;
  background-color: #025F70;
  border-color: black;
  	transition: all 0.50s ease;
	-
	font-weight: normal
  
}

#enter:hover{
	background-color: #02798F;
	color: #FFCD5D;
}



li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  list-style: none;
	padding: 10px 20px ;
	color: black;
	text-transform: capitalize;
	font-weight: 600;
	border: 2px solid #025f70;
	border-radius: 130px;
	margin-bottom: 10px;
  margin-top: 15px;
  margin-left: 300px;
  margin-right: 300px;
	background: #E6EDEC;
	transition: all 0.75s
};

.buttons {
  width: 100px;
  height: 50px;
  position: absolute;
  top: 0;
  right: 0;
  float: right;
  
  
}

.Remove {
  border-radius: 30px;
  padding: 10px 15px;
  color: ;
  border-width: 2px;
  background-color: #C8EDEC;
  border-color: black;

}

.Complete {
   border-radius: 50px;
  padding: 10px 15px;
  color: ;
  background-color: #C8EDEC ;
  border-color: black;
  
  	
}

.Complete :hover{
	color: #FFCD5D;
}

.Remove :hover{
color: #FF0000;
}

.done {
  background: #51DF70 !important;
}

.delete {
	display: none;
}
@media (max-width: 453px) {
  #enter {
    margin-top: 20px;
  }
  
  li {
  margin-left: 10%;
    padding-right: 220px;
    
    
  }
  
  .buttons{
    margin-right: 40px;
  }
  
  
  
  
  
  
  
}
 
            
          
!

JS

            
              var input = document.getElementById('userInput');
var enterButton = document.getElementById('enter');
// var deleteButtons = document.getElementsByClassName("Remove");
//   for(var i = 0; i < deleteButtons.length; i++){
//     deleteButtons[i].addEventListener('click', deleteListItem, false);
//   }

// var completeButtons =
//   document.getElementsByClassName("Complete");
//     for(var i = 0; i < completeButtons.length; i++){
//       completeButtons[i].addEventListener('click', completeListItem, false);
//     }
var ul = document.querySelector('ul');

function inputLength(){
 return input.value.length;
};

function listLength(){
  return item.length;
}

function createListElement(){
  var li = document.createElement('li');
  li.appendChild(document.createTextNode(input.value));
  //makes text node 
  
  var clonedButton = 
     document.getElementById("buttons").cloneNode(true);
      clonedButton.childNodes[1].addEventListener('click', deleteListItem, false); 
      clonedButton.childNodes[3].addEventListener('click', completeListItem, false); 
  
  li.appendChild(clonedButton);
  ul.appendChild(li);
  input.value = "";
  
}

function deleteListItem(){
  	var li = this.parentNode.parentNode;
    li.remove();
}

function completeListItem(){
   var li = this.parentNode.parentNode;
  li.classList.add("done");
  
}

function addListAfterClick(){
  if(inputLength() > 0){
    createListElement();
  }
}
// Hit enter key and create list
function addAfterPress(event){
  if(inputLength() > 0 && event.which === 13){
    createListElement();
  }
}



enterButton.addEventListener('click', addListAfterClick);
input.addEventListener('keypress', addAfterPress);







            
          
!
999px

Console