<!doctype html><html lang="en"><head> <meta charset="utf-8"> <title>To do list</title><link href='http://fonts.googleapis.com/css?family=Arvo:400,700,400italic,700italic' rel='stylesheet' type='text/css'> <h1>To Do List</h1> <style>button {margin-left: 30px;}h1 {font-family:'Arvo', slab-serif; font-size: 25pt; margin-left:30px;} div { display: none; margin-left: 30px; padding:5px; <!--to give space between each button--> } p { font-weight: bold; background-color: #fcd; }</style> <script src="https://code.jquery.com/jquery-1.10.2.js"></script></head><body> <button>Add</button><div> <form> <input type="text"> <button>Completed</button> </form></div> <script>function add() { $( "div" ).show( "fast" );}$( "button" ).click(function(){ $("div").append("$("input"); $( "form" ).submit(function( event ) { if ( $( "input" ).val() === "yes" ) { $( "p" ).show( 4000, function() { $( this ).text( "Ok, DONE! (now showing)" ); }); } $( "div" ).hide( "fast" ); // Prevent form submission event.preventDefault();});</script> </body></html>
It's not javascript but I was hoping to get a feedback with the problem I have.
I'm trying to make it so that everytime I click "add" button, input box adds on.
I used .append but not working at all.
any suggestions??