3- Create a new post. Unsure why this isn't working


#1



https://www.codecademy.com/courses/web-beginner-en-hk5qh/0/3?content_from=make-an-interactive-website%3Ajquery-dom-manipulation#


I've followed the steps and my code even looks exactly what the hint says it should look like, yet I'm getting this error:

Oops, try again. It looks like the Post button didn't add a new message. Remember to prepend a new li element inside the event handler.

EDIT: So I copied and pasted the code stated in the hint and now it's working. Is this just a bug or was there actually something wrong with my code?

var main = function() {
    $('btn').click(function(){
        var post =  $('.status-box').val();
        $('<li>').text(post).prependTo('.posts');
    });
}


$(document).ready(main);


#2

HI this line

$('btn').click(function()

its missing the dot to 'btn' should be '.btn'


#3

That would do it :disappointed_relieved::grin: Thank you very much. This is why long hours of coding are bad for you. Always take a break every now and then, even if it's just for 5 minutes. Otherwise little things like that are hard to spot.


#4

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