This won't work... Create a new post


#1

var main = function() {
$('.btn').click(function() {
var post = $('.status-box').val();
$('

  • ').text(post).prependTo('.posts');
    });
    }
    This wont work.

  • #2

    Having trouble with this also. Did you ever get this corrected?


    #3

    Hi James,

    Next time, please give the error message you're getting - it generally makes debugging your code easier for us.

    In this case, it wasn't too hard to figure out though :)
    You need to run main() once the page is loaded. You can do that by adding this to the bottom of app.js:

    $(document).ready(main);

    I hope this helps, please let me know if you're still having trouble with the exercise :)


    #4

    A post was split to a new topic: Posts don't contain any text when added