Mastering Manipulations 10-14. Does't creating new element


When I click on button, it does not creating div elements. Where I was wrong?


<!DOCTYPE html>
        <title>To Do</title>
        <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
        <script type="text/javascript" src="script.js"></script>
        <h2>To Do</h2>
        <form name="checkListForm">
            <input type="text" name="checkListItem"/>
        <button id="button">Add!</button>
        <div class="list"></div>


    function() {
       $('#button').click(function () {
                var toAdd = $('input[name=checkListItem]').val();
                $('.list').append('<div class="item">' + toAdd + '</div>');
        $(document).on('click', '.item', function() {



You are not going to see a change in your code, You will just see it in preview.
Add another paragraph or element to your HTML and then use jQuery to add more and you will see all displayed.


I can't see how code work in browser. When I click on button it should add my entered text in the list and I have to see it in browser. Then I should click on text list item and it should be removed. Is'n it?. As I understand the task right.


Yes that's what it does,

I copied your code over and tested works perfect !


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.