11/14 System throws an error


Hi to All! My code is correct i guess but the system throws an error ((Oops, try again. Did you put '#button' inside your $().click() ?)). Have somebody experienced similar issue? If so, please let me know what to do!


Judging by the error you should have $('#button').click(). I can't see your code so I can't offer any advices, how can you be certain it's correct?


My code is following

$(document).ready(function () {

var input = $('input[name=checkListItem]').val();

    var toAdd = input;



Here is my code (it works).

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

It's practically the same, but try with my code because you will assign value to input at the time document is loaded. at that time document is empty and then assign that value to toAdd. I will assign my value to toAdd only when the button is clicked. I believe this will resolve your problem.


Thanks it works!!! I don't know what was wrong maybe semicolons in my code?


I'm not 100% sure, but as I said, you assigned the $('input[name=checkListItem]').val(); to some variable called input. And you did it immediately after document becomes ready, and at that point, input item is empty. So I think you was adding and empty value to your toAdd variable and that caused the code to fail at evaluation.


Ok thanks for explanation!!!