Why I don't see my text?


#1


https://www.codecademy.com/en/courses/web-beginner-en-v6phg/2/3?curriculum_id=50a3fad8c7a770b5fd0007a1


Hello, the exercise is correct, but I don't understand why, if I write something in the form field and then I click Add, it says undefined otherwise the input I wrote.


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

});


#2

here:

var toAdd = $("input[checkListItem]").val();

you need to specify which input field you want the value, in this case input with name checkListItem


#3

Thank you very much!


#4

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