javascript - jQuery list quantity not showing -
i'm new jquery , coding in general. after several days being dragged in mud making shopping list app in jquery i've made lot of progress, i'm struggling 2 things.
my quantity selector implemented once number quantity selected , added, wont show on list. i'm having hard time seeing , i'm missing proper string make quantity show in list when add button clicked.
heres code demo: http://jsbin.com/cetisobuhe/edit?html,js,output
you not adding second <input />
's value:
var new_task = $('input').val() + ": " + $('input + input').val();
in current implementation, kinda wrong, above code works. see this:
output: http://output.jsbin.com/negiguhumu/1
better version
instead of using this:
<input type="text" id="new-text" placeholder="add item list"/> <input type="number">
var new_task = $('input').val() + ": " + $('input + input').val();
it better use:
<input type="text" id="new-text" placeholder="add item list" /> <input type="number" id="quantity" />
var new_task = $('#new-text').val() + ": " + $('#quantity').val();
Comments
Post a Comment