Interactive website 3. Create a New Post


#1



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


"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."

I'm not sure what I'm doing wrong.

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


#2

you should close ( } ) the main function before $(document).ready(main);

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

#3

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