DEV Community

Sushil Shrestha
Sushil Shrestha

Posted on

Answer: Using jQuery .append should add new li with the value from input field, but it only add empty li

Your code let currentItem = $('#newItem').val(); Doesn't works because it is outside button click event. So execute let currentItem = $('#newItem').val();only after the button is clicked. I would like to suggest to bind and unbind the event while using click events. And also check the if the…

Top comments (0)